Skip to content

Commit 8df4cfb

Browse files
committed
fix, add more tests [skip cirrus]
1 parent 2e134c1 commit 8df4cfb

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

numpy/lib/_npyio_impl.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,25 +286,25 @@ def get(self, key, default=None, /):
286286
"""
287287
D.get(k,[,d]) returns D[k] if k in D, else d. d defaults to None.
288288
"""
289-
return dict.get(self, key, default)
289+
return Mapping.get(self, key, default)
290290

291291
def items(self):
292292
"""
293293
D.items() returns a set-like object providing a view on the items
294294
"""
295-
return dict.items(self)
295+
return Mapping.items(self)
296296

297297
def keys(self):
298298
"""
299299
D.keys() returns a set-like object providing a view on the keys
300300
"""
301-
return dict.keys(self)
301+
return Mapping.keys(self)
302302

303303
def values(self):
304304
"""
305305
D.values() returns a set-like object providing a view on the values
306306
"""
307-
return dict.values(self)
307+
return Mapping.values(self)
308308

309309

310310
@set_module('numpy')

numpy/lib/tests/test_io.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2760,12 +2760,16 @@ def test_npzfile_dict():
27602760
assert_(f in ['x', 'y'])
27612761
assert_equal(a.shape, (3, 3))
27622762

2763+
for a in z.values():
2764+
assert_equal(a.shape, (3, 3))
2765+
27632766
assert_(len(z.items()) == 2)
27642767

27652768
for f in z:
27662769
assert_(f in ['x', 'y'])
27672770

27682771
assert_('x' in z.keys())
2772+
assert (z.get('x') == z['x']).all()
27692773

27702774

27712775
@pytest.mark.skipif(not HAS_REFCOUNT, reason="Python lacks refcounts")

0 commit comments

Comments
 (0)