weaverba137 / pydl

Library of IDL astronomy routines converted to Python.
BSD 3-Clause "New" or "Revised" License
28 stars 16 forks source link

Some tests fail on 32 bits architectures #14

Closed ViviCoder closed 7 years ago

ViviCoder commented 7 years ago

When running tests on a 32-bits architecture, some tests fail with the following trace:

=================================== FAILURES ===================================
__________________ [doctest] pydl.pydlutils.misc.djs_laxisgen __________________
050 
051     Notes
052     -----
053     For two or more dimensions, there is no difference between this routine
054     and :func:`~pydl.pydlutils.misc.djs_laxisnum`.
055 
056     Examples
057     --------
058     >>> from pydl.pydlutils.misc import djs_laxisgen
059     >>> djs_laxisgen([4,4])
Differences (unified diff with -expected +actual):
    @@ -2,3 +2,3 @@
            [1, 1, 1, 1],
            [2, 2, 2, 2],
    -       [3, 3, 3, 3]], dtype=int32)
    +       [3, 3, 3, 3]])

pydl/pydlutils/misc.py:59: DocTestFailure
__________________ [doctest] pydl.pydlutils.misc.djs_laxisnum __________________
092 
093     Notes
094     -----
095     For two or more dimensions, there is no difference between this routine
096     and :func:`~pydl.pydlutils.misc.djs_laxisgen`.
097 
098     Examples
099     --------
100     >>> from pydl.pydlutils.misc import djs_laxisnum
101     >>> djs_laxisnum([4,4])
Differences (unified diff with -expected +actual):
    @@ -2,3 +2,3 @@
            [1, 1, 1, 1],
            [2, 2, 2, 2],
    -       [3, 3, 3, 3]], dtype=int32)
    +       [3, 3, 3, 3]])

pydl/pydlutils/misc.py:101: DocTestFailure
___________________ [doctest] pydl.pydlutils.sdss.sdss_objid ___________________
326         out of bounds.
327 
328     Notes
329     -----
330     firstField flag never set.
331 
332     Examples
333     --------
334     >>> from pydl.pydlutils.sdss import sdss_objid
335     >>> sdss_objid(3704,3,91,146)
Expected:
    array([1237661382772195474])
Got:
    array([1237661382772195474], dtype=int64)

pydl/pydlutils/sdss.py:335: DocTestFailure
___________________________ TestSDSS.test_sdss_objid ___________________________

self = <pydl.pydlutils.tests.test_sdss.TestSDSS object at 0xb398fa50>

    def test_sdss_objid(self):
        assert sdss_objid(3704, 3, 91, 146) == 1237661382772195474
        run = np.array([3704, 1000])
        camcol = np.array([3, 6])
        field = np.array([91, 77])
        obj = np.array([146, 123])
>       assert (np.array([1237661382772195474, 1237649770790322299]) ==
                sdss_objid(run, camcol, field, obj)).all()
E       assert <built-in method all of numpy.ndarray object at 0xb3b00ef8>()
E        +  where <built-in method all of numpy.ndarray object at 0xb3b00ef8> = array([123766..., dtype=int64) == array([1237645..., dtype=int64)
E           Use -v to get the full diff.all

pydl/pydlutils/tests/test_sdss.py:132: AssertionError
_______________________ TestYanny.test_write_table_yanny _______________________

self = <pydl.pydlutils.tests.test_yanny.TestYanny object at 0xb3960490>

    def test_write_table_yanny(self):
        """Test writing an astropy Table to yanny.
            """
        filename = self.data('table.par')
        a = [1, 4, 5]
        b = [2.0, 5.0, 8.2]
        c = [b'x', b'y', b'z']
        t = Table([a, b, c], names=('a', 'b', 'c'),
                  meta={'name': 'first table'})
        t.write(filename, tablename='test')
        par1 = yanny(filename)
        par2 = yanny(self.data('test_table.par'))
>       assert par1 == par2
E       assert #%yanny\n# Tab...\nTEST 5 8.2 z\n == #%yanny\n# Tabl...\nTEST 5 8.2 z\n
E         Omitting 1 identical items, use -v to show
E         Differing items:
E         {'TEST': rec.array([(1, 2.0, 'x'), (4, 5.0, 'y'), (5, 8.2, 'z')], \n          dtype=[('a', '<i4'), ('b', '<f8'), ('c', 'S1')])} != {'TEST': rec.array([(1L, 2.0, 'x'), (4L, 5.0, 'y'), (5L, 8.2, 'z')], \n          dtype=[('a', '<i8'), ('b', '<f8'), ('c', 'S1')])}
E         Use -v to get the full diff

pydl/pydlutils/tests/test_yanny.py:129: AssertionError
weaverba137 commented 7 years ago

I've got a working 32-bit environment now where I can reproduce this. Should be straightforward to fix these tests.