def test_raise_error_total_(self): test_nums = [-1, 0, 1, 2, 3] test_probabilities = [0.3, 0.3, 0.3, 0.1, 0.1] with self.assertRaises(ValueError): instance = man_ahl.RandomGen(test_nums, test_probabilities)
def test_raise_error_greater_one(self): test_nums = [-1, 0, 1, 2, 3] test_probabilities = [0, 1.1, 0, 0.1, 0.2] with self.assertRaises(ValueError): instance = man_ahl.RandomGen(test_nums, test_probabilities)
def test_raise_error_length(self): test_nums = [-1, 0, 1, 2, 3, 4, 5] test_probabilities = [0, 0, 1, 0, 0] with self.assertRaises(ValueError): instance = man_ahl.RandomGen(test_nums, test_probabilities)
def test_raise_error_negative(self): test_nums = [-1, 0, 1, 2, 3] test_probabilities = [-1, 0.2, 1, 0.4, 0.4] with self.assertRaises(ValueError): instance = man_ahl.RandomGen(test_nums, test_probabilities)
def test_prob1(self): test_nums = [-1, 0, 1, 2, 3] test_probabilities = [0, 0, 1, 0, 0] instance = man_ahl.RandomGen(test_nums, test_probabilities) self.assertEqual(instance.next_num(), 1)