12 Ensure that arm distributions have means on the range [-1, 1) and
13 standard deviations of 1.
20 (mean, std) = bandit.trueValues()
23 self.assertTrue((mean >= -1.0).all(),
24 msg=
'Selected means have a value below -1.0.')
25 self.assertTrue((mean < 1.0).all(),
26 msg=
'Selected means have a value above 1.0.')
28 self.assertTrue((std == 1.0).all(),
29 msg=
'Standard deviations are not all 1.0.')
33 Test that rewards of the correct shape are produced.
35 Since any numeric value is technically possible, only check that the
36 right number of rewards are returned.
42 for arm
in (-3, 0, 2, 9):
43 reward = bandit.select(arm)
44 self.assertTrue(isinstance(reward, float))
46 reward = bandit.select(range(K))
47 self.assertEqual(len(reward), K)
49 self.assertIsNone(bandit.select(
None))
51 for i
in (0.5, K,
'1',
'the'):
52 with self.subTest(i=i):
53 with self.assertRaises(Exception, msg=
'Incorrect indices not rejected.'):
54 reward = bandit.select(i)