Browse code

add a test to ask for 0 points

Bas Nijholt authored on 17/03/2019 16:07:56
Showing 1 changed files
... ...
@@ -34,6 +34,14 @@ def test_distribute_first_points_over_learners():
34 34
         assert len(set(i_learner)) == len(learners)
35 35
 
36 36
 
37
+def test_ask_0():
38
+    for strategy in ['loss', 'loss_improvements', 'npoints']:
39
+        learners = [Learner1D(lambda x: x, bounds=(-1, 1)) for i in range(10)]
40
+        learner = BalancingLearner(learners, strategy=strategy)
41
+        points, _ = learner.ask(0)
42
+        assert len(points) == 0
43
+
44
+
37 45
 def test_strategies():
38 46
     goals = {
39 47
         'loss': lambda l: l.loss() < 0.1,