Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow test_indexes to pass on big-endian systems #7026

Merged
merged 1 commit into from
Sep 12, 2022
Merged

Allow test_indexes to pass on big-endian systems #7026

merged 1 commit into from
Sep 12, 2022

Conversation

ginggs
Copy link
Contributor

@ginggs ginggs commented Sep 12, 2022

No description provided.

@ginggs
Copy link
Contributor Author

ginggs commented Sep 12, 2022

Since the 2022.06.0 release, the following tests have been failing in Debian and Ubuntu on big-endian systems:

=================================== FAILURES ===================================
__________________________ TestPandasIndex.test_join ___________________________

self = <xarray.tests.test_indexes.TestPandasIndex object at 0x3ff828b6ef0>

    def test_join(self) -> None:
        index1 = PandasIndex(["a", "aa", "aaa"], "x", coord_dtype="<U3")
        index2 = PandasIndex(["aa", "aaa", "aaaa"], "x", coord_dtype="<U4")
    
        expected = PandasIndex(["aa", "aaa"], "x")
        actual = index1.join(index2)
        print(actual.index)
        assert actual.equals(expected)
>       assert actual.coord_dtype == "<U4"
E       AssertionError: assert dtype('>U4') == '<U4'
E        +  where dtype('>U4') = <xarray.core.indexes.PandasIndex object at 0x3ff716d5300>.coord_dtype

/usr/lib/python3/dist-packages/xarray/tests/test_indexes.py:267: AssertionError
----------------------------- Captured stdout call -----------------------------
Index(['aa', 'aaa'], dtype='object', name='x')
_______________________ TestPandasMultiIndex.test_concat _______________________

self = <xarray.tests.test_indexes.TestPandasMultiIndex object at 0x3ff82e70370>

    def test_concat(self) -> None:
        pd_midx = pd.MultiIndex.from_product(
            [[0, 1, 2], ["a", "b"]], names=("foo", "bar")
        )
        level_coords_dtype = {"foo": np.int32, "bar": "<U1"}
    
        midx1 = PandasMultiIndex(
            pd_midx[:2], "x", level_coords_dtype=level_coords_dtype
        )
        midx2 = PandasMultiIndex(
            pd_midx[2:], "x", level_coords_dtype=level_coords_dtype
        )
        expected = PandasMultiIndex(pd_midx, "x", level_coords_dtype=level_coords_dtype)
    
        actual = PandasMultiIndex.concat([midx1, midx2], "x")
        assert actual.equals(expected)
>       assert actual.level_coords_dtype == expected.level_coords_dtype
E       AssertionError: assert {'bar': dtype...type('int32')} == {'bar': '<U1'...numpy.int32'>}
E         Omitting 1 identical items, use -vv to show
E         Differing items:
E         {'bar': dtype('>U1')} != {'bar': '<U1'}
E         Full diff:
E         - {'bar': '<U1', 'foo': <class 'numpy.int32'>}
E         + {'bar': dtype('>U1'), 'foo': dtype('int32')}

/usr/lib/python3/dist-packages/xarray/tests/test_indexes.py:395: AssertionError
________________________ TestPandasMultiIndex.test_join ________________________

self = <xarray.tests.test_indexes.TestPandasMultiIndex object at 0x3ff828b6590>

    def test_join(self):
        midx = pd.MultiIndex.from_product([["a", "aa"], [1, 2]], names=("one", "two"))
        level_coords_dtype = {"one": "<U2", "two": "i"}
        index1 = PandasMultiIndex(midx, "x", level_coords_dtype=level_coords_dtype)
        index2 = PandasMultiIndex(midx[0:2], "x", level_coords_dtype=level_coords_dtype)
    
        actual = index1.join(index2)
        assert actual.equals(index2)
>       assert actual.level_coords_dtype == level_coords_dtype
E       AssertionError: assert {'one': dtype...type('int32')} == {'one': '<U2', 'two': 'i'}
E         Omitting 1 identical items, use -vv to show
E         Differing items:
E         {'one': dtype('>U2')} != {'one': '<U2'}
E         Full diff:
E         - {'one': '<U2', 'two': 'i'}
E         + {'one': dtype('>U2'), 'two': dtype('int32')}

/usr/lib/python3/dist-packages/xarray/tests/test_indexes.py:493: AssertionError

Full test log on IBM s390x with Ubuntu 22.10:
https://autopkgtest.ubuntu.com/results/autopkgtest-kinetic/kinetic/s390x/p/python-xarray/20220911_200538_24725@/log.gz

Copy link
Collaborator

@mathause mathause left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@mathause mathause merged commit 1afba66 into pydata:main Sep 12, 2022
@mathause
Copy link
Collaborator

Thanks!

@ginggs ginggs deleted the patch-2 branch September 14, 2022 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants