def test_likelihood_10_approximately_result(self): true_values, false_values = 0, 0 iterations = 10000 likelihood = 0.1 infelicity = 0.1 for x in range(0, iterations): if chance.boolean(int(likelihood * 100)): true_values += 1 else: false_values += 1 res = float(true_values) / false_values self.assertTrue(res > (likelihood - infelicity))
def test_boolean_returns_bool(self): for x in range(0, 200): self.assertTrue(isinstance(chance.boolean(), bool))