MHKiT-Software / MHKiT-Python

MHKiT-Python provides the marine renewable energy (MRE) community tools for data processing, visualization, quality control, resource assessment, and device performance.
https://mhkit-software.github.io/MHKiT/
BSD 3-Clause "New" or "Revised" License
47 stars 45 forks source link

Fix Failing test on `develop` #306

Closed ssolson closed 2 months ago

ssolson commented 2 months ago

Pulls to develop have been failing in the D3D module for an int32 vs int64 index in the d3d io module specifically on windows builds.

image

This PR ignores those differences and thereby fixes the failing tests.

Example of test failure output below:

================================== FAILURES ===================================
_________________ TestIO.test_create_points_array_like_inputs _________________

self = <mhkit.tests.river.test_io_d3d.TestIO testMethod=test_create_points_array_like_inputs>

    def test_create_points_array_like_inputs(self):
        """
        Test array-like inputs such as lists.
        """
        result = river.io.d3d.create_points([1, 2], [3, 4], [5, 6])
        expected = pd.DataFrame(
            {"x": [1, 2, 1, 2], "y": [3, 4, 3, 4], "waterdepth": [5, 5, 6, 6]}
        )

>       pd.testing.assert_frame_equal(
            result, expected, check_dtype=False, check_names=False
        )

mhkit\tests\river\test_io_d3d.py:1[70](https://github.com/MHKiT-Software/MHKiT-Python/actions/runs/8558019568/job/23459345139#step:7:71): 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

left = Index([0, 1, 2, 3], dtype='int32', name='index')
right = RangeIndex(start=0, stop=4, step=1), obj = 'DataFrame.index'

    def _check_types(left, right, obj: str = "Index") -> None:
        if not exact:
            return

        assert_class_equal(left, right, exact=exact, obj=obj)
        assert_attr_equal("inferred_type", left, right, obj=obj)

        # Skip exact dtype checking when `check_categorical` is False
        if is_categorical_dtype(left.dtype) and is_categorical_dtype(right.dtype):
            if check_categorical:
                assert_attr_equal("dtype", left, right, obj=obj)
                assert_index_equal(left.categories, right.categories, exact=exact)
            return

>       assert_attr_equal("dtype", left, right, obj=obj)
E       AssertionError: DataFrame.index are different
E       
E       Attribute "dtype" are different
E       [left]:  int32
E       [right]: int64