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