MCPcopy
hub / github.com/numpy/numpy / test_npzfile_dict

Function test_npzfile_dict

numpy/lib/tests/test_io.py:2654–2682  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2652
2653
2654def test_npzfile_dict():
2655 s = BytesIO()
2656 x = np.zeros((3, 3))
2657 y = np.zeros((3, 3))
2658
2659 np.savez(s, x=x, y=y)
2660 s.seek(0)
2661
2662 z = np.load(s)
2663
2664 assert_('x' in z)
2665 assert_('y' in z)
2666 assert_('x' in z.keys())
2667 assert_('y' in z.keys())
2668
2669 for f, a in z.items():
2670 assert_(f in ['x', 'y'])
2671 assert_equal(a.shape, (3, 3))
2672
2673 for a in z.values():
2674 assert_equal(a.shape, (3, 3))
2675
2676 assert_(len(z.items()) == 2)
2677
2678 for f in z:
2679 assert_(f in ['x', 'y'])
2680
2681 assert_('x' in z.keys())
2682 assert (z.get('x') == z['x']).all()
2683
2684
2685@pytest.mark.skipif(not HAS_REFCOUNT, reason="Python lacks refcounts")

Callers

nothing calls this directly

Calls 8

assert_Function · 0.90
assert_equalFunction · 0.90
seekMethod · 0.80
itemsMethod · 0.80
keysMethod · 0.45
valuesMethod · 0.45
allMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…