1+ from typing import Callable
2+
13import pytest
24
35from adaptive .learner import BalancingLearner , Learner1D
68strategies = ["loss" , "loss_improvements" , "npoints" , "cycle" ]
79
810
9- def test_balancing_learner_loss_cache ():
11+ def test_balancing_learner_loss_cache () -> None :
1012 learner = Learner1D (lambda x : x , bounds = (- 1 , 1 ))
1113 learner .tell (- 1 , - 1 )
1214 learner .tell (1 , 1 )
@@ -27,7 +29,7 @@ def test_balancing_learner_loss_cache():
2729
2830
2931@pytest .mark .parametrize ("strategy" , strategies )
30- def test_distribute_first_points_over_learners (strategy ) :
32+ def test_distribute_first_points_over_learners (strategy : str ) -> None :
3133 for initial_points in [0 , 3 ]:
3234 learners = [Learner1D (lambda x : x , bounds = (- 1 , 1 )) for i in range (10 )]
3335 learner = BalancingLearner (learners , strategy = strategy )
@@ -42,7 +44,7 @@ def test_distribute_first_points_over_learners(strategy):
4244
4345
4446@pytest .mark .parametrize ("strategy" , strategies )
45- def test_ask_0 (strategy ) :
47+ def test_ask_0 (strategy : str ) -> None :
4648 learners = [Learner1D (lambda x : x , bounds = (- 1 , 1 )) for i in range (10 )]
4749 learner = BalancingLearner (learners , strategy = strategy )
4850 points , _ = learner .ask (0 )
@@ -58,7 +60,7 @@ def test_ask_0(strategy):
5860 ("cycle" , lambda l : l .loss () < 0.1 ),
5961 ],
6062)
61- def test_strategies (strategy , goal ) :
63+ def test_strategies (strategy : str , goal : Callable ) -> None :
6264 learners = [Learner1D (lambda x : x , bounds = (- 1 , 1 )) for i in range (10 )]
6365 learner = BalancingLearner (learners , strategy = strategy )
6466 simple (learner , goal = goal )
0 commit comments