MCPcopy
hub / github.com/numpy/numpy / test_zero_padding

Function test_zero_padding

numpy/random/tests/test_seed_sequence.py:56–79  ·  view source on GitHub ↗

Ensure that the implicit zero-padding does not cause problems.

()

Source from the content-addressed store, hash-verified

54
55
56def test_zero_padding():
57 """ Ensure that the implicit zero-padding does not cause problems.
58 """
59 # Ensure that large integers are inserted in little-endian fashion to avoid
60 # trailing 0s.
61 ss0 = SeedSequence(42)
62 ss1 = SeedSequence(42 << 32)
63 assert_array_compare(
64 np.not_equal,
65 ss0.generate_state(4),
66 ss1.generate_state(4))
67
68 # Ensure backwards compatibility with the original 0.17 release for small
69 # integers and no spawn key.
70 expected42 = np.array([3444837047, 2669555309, 2046530742, 3581440988],
71 dtype=np.uint32)
72 assert_array_equal(SeedSequence(42).generate_state(4), expected42)
73
74 # Regression test for gh-16539 to ensure that the implicit 0s don't
75 # conflict with spawn keys.
76 assert_array_compare(
77 np.not_equal,
78 SeedSequence(42, spawn_key=(0,)).generate_state(4),
79 expected42)

Callers

nothing calls this directly

Calls 3

assert_array_compareFunction · 0.90
assert_array_equalFunction · 0.90
generate_stateMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…