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

Fix numpy 2 deprecation warning in test #1223

Merged
merged 2 commits into from
Dec 20, 2024
Merged

Fix numpy 2 deprecation warning in test #1223

merged 2 commits into from
Dec 20, 2024

Conversation

rly
Copy link
Contributor

@rly rly commented Dec 19, 2024

There is one deprecation warning when running the HDMF tests:

_______________________________________________________________________ H5DataIOValid.test_link ________________________________________________________________________

self = <tests.unit.test_io_hdf5_h5tools.H5DataIOValid testMethod=test_link>

    def test_link(self):
        """Test that wrapping of linked data within H5DataIO """
        with HDF5IO(self.paths[0], manager=get_foo_buildmanager(), mode='r') as io:
            read_foofile1 = io.read()
    
            self.foo2 = Foo('foo2', H5DataIO(data=read_foofile1.buckets['bucket1'].foos['foo1'].my_data),
                            "I am foo2", 17, 3.14)
            bucket2 = FooBucket('bucket2', [self.foo2])
            foofile2 = FooFile(buckets=[bucket2])
    
            self.paths.append(get_temp_filepath())
    
            with HDF5IO(self.paths[1], manager=get_foo_buildmanager(), mode='w') as io:
                io.write(foofile2)
    
            self.assertTrue(self.foo2.my_data.valid)  # test valid
            self.assertEqual(len(self.foo2.my_data), 5)  # test len
            self.assertEqual(self.foo2.my_data.shape, (5,))  # test getattr with shape
>           self.assertTrue(np.array_equal(np.array(self.foo2.my_data), [1, 2, 3, 4, 5]))  # test array conversion
E           DeprecationWarning: __array__ implementation doesn't accept a copy keyword, so passing copy=False failed. __array__ must implement 'dtype' and 'copy' keyword arguments. To learn more, see the migration guide https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword

This PR fixes the issue.

Copy link

codecov bot commented Dec 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.82%. Comparing base (b779d08) to head (182eb88).
Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1223   +/-   ##
=======================================
  Coverage   90.82%   90.82%           
=======================================
  Files          43       43           
  Lines        9524     9524           
  Branches     2723     2723           
=======================================
  Hits         8650     8650           
  Misses        580      580           
  Partials      294      294           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rly rly requested a review from oruebel December 19, 2024 23:55
@rly rly enabled auto-merge (squash) December 19, 2024 23:55
@rly rly merged commit 8194a8a into dev Dec 20, 2024
28 of 29 checks passed
@rly rly deleted the np_deprecation_warning branch December 20, 2024 00:00
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.

2 participants