示例#1
0
 def test_two_arms_one_winner(self):
     """Check that the two-arms case with one winner always returns the winning arm."""
     arms_to_allocations = {"arm1": 1.0, "arm2": 0.0}
     T.assert_equal(BanditInterface.choose_arm(arms_to_allocations), "arm1")
示例#2
0
 def test_three_arms_two_winners(self):
     """Check that the three-arms cases with two winners return one of the two winners."""
     arms_to_allocations = {"arm1": 0.5, "arm2": 0.5, "arm3": 0.0}
     T.assert_in(BanditInterface.choose_arm(arms_to_allocations), frozenset(["arm1", "arm2"]))
示例#3
0
 def test_one_arm(self):
     """Check that the one-arm case always returns the given arm as the winning arm."""
     arms_to_allocations = {"arm1": 1.0}
     T.assert_equal(BanditInterface.choose_arm(arms_to_allocations), "arm1")