Tests shuffling and drawing random number of perturbations.
()
| 34 | |
| 35 | |
| 36 | def test_shuffle(): |
| 37 | """ |
| 38 | Tests shuffling and drawing random number of perturbations. |
| 39 | """ |
| 40 | params = PerturbationParams(1, 10) |
| 41 | manager = PerturbationManager(params) |
| 42 | |
| 43 | rng = RandomNumberGenerator(seed=42) |
| 44 | for _ in range(10): # all samples should be within bounds |
| 45 | manager.shuffle(rng) |
| 46 | assert_(1 <= manager.num_perturbations() <= 10) |
| 47 | |
| 48 | params = PerturbationParams(0, 0) |
| 49 | manager = PerturbationManager(params) |
| 50 | for _ in range(10): # same, but now we can only draw one outcome: 0 |
| 51 | manager.shuffle(rng) |
| 52 | assert_equal(manager.num_perturbations(), 0) |
| 53 | |
| 54 | |
| 55 | def test_num_perturbations_randomness(): |
nothing calls this directly
no test coverage detected