Skip to content

Conversation

@olebole
Copy link
Contributor

@olebole olebole commented Mar 2, 2025

During the update of the Debian package for glue I observed one failure when the test runs on a 32-bit machine:

________________________________ test_dtype_int ________________________________
    def test_dtype_int():
        data = b'# a, b\n1, 1 \n2, 2 \n3, 3'
        with make_file(data, '.csv') as fname:
            d = df.load_data(fname)
>       assert d['a'].dtype == int
E       AssertionError: assert dtype('int64') == int
E        +  where dtype('int64') = array([1, 2, 3], dtype=int64).dtype
glue/core/data_factories/tests/test_data_factories.py:125: AssertionError

This patch fixes this by explicitly using np.int64 instead of int.

This one failed on 32 bit architectures
@dhomeier
Copy link
Collaborator

dhomeier commented Mar 3, 2025

Thanks for finding this! I suspect this has sneaked in with Numpy 2; just wondering if this still passes with Numpy 1.x on 32bit, but we don't have either in our test matrix.

with make_file(data, '.csv') as fname:
d = df.load_data(fname)
assert d['a'].dtype == int
assert d['a'].dtype == np.int64
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be sufficient to check assert d['a'].dtype.kind == 'i' - as we don't actually care what kind of integer it is

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm that this change works with both32 and 64 bit. Thanks for the hint.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your fix!

@dhomeier
Copy link
Collaborator

@olebole I don't see how the dtype.kind test could not work on 32 bit, but if you have time to verify, that would be great.

@dhomeier dhomeier merged commit f933d4b into glue-viz:main Mar 19, 2025
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants