Ensure that the implicit zero-padding does not cause problems.
()
| 54 | |
| 55 | |
| 56 | def 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) |
nothing calls this directly
no test coverage detected
searching dependent graphs…