(self)
| 117 | self.assertEqual(vals_1, vals_2) |
| 118 | |
| 119 | def test_seed_randomizes(self): |
| 120 | # |
| 121 | # suggest() algorithms can be either stochastic (e.g. random search) |
| 122 | # or deterministic (e.g. grid search). If an suggest implementation |
| 123 | # is stochastic, then changing the seed argument should change the |
| 124 | # return value. |
| 125 | # |
| 126 | if not self.seed_randomizes: |
| 127 | return |
| 128 | |
| 129 | # -- sample 20 points to make sure we get some differences even |
| 130 | # for small search spaces (chance of false failure is 1/million). |
| 131 | idxs_1, vals_1 = self.idxs_vals_from_ids(ids=list(range(20)), seed=45) |
| 132 | idxs_2, vals_2 = self.idxs_vals_from_ids(ids=list(range(20)), seed=46) |
| 133 | self.assertNotEqual((idxs_1, vals_1), (idxs_2, vals_2)) |
| 134 | |
| 135 | |
| 136 | class TestTrials(unittest.TestCase): |
nothing calls this directly
no test coverage detected