def main(): print(FizzBuzzChecker.is_fizzbuzz(6)) print(FizzBuzzChecker.is_fizzbuzz(10)) print(FizzBuzzChecker.is_fizzbuzz(15)) print(FizzBuzzChecker.is_fizzbuzz(17)) try: print(FizzBuzzChecker.is_fizzbuzz("15")) except: print("error not int detected") try: print(FizzBuzzChecker.is_fizzbuzz(0)) except: print("error negative or zero value detected")
def test_should_raise_error_with_negative_value(self): with self.assertRaises(ValueError): FizzBuzzChecker.is_fizzbuzz(-1)
def test_should_raise_error_with_0(self): with self.assertRaises(ValueError): FizzBuzzChecker.is_fizzbuzz(0)
def test_value_type(self): with self.assertRaises(TypeError): FizzBuzzChecker.is_fizzbuzz("15")
def test_should_return_alice_number_by_default(self): actual = FizzBuzzChecker.is_fizzbuzz(17) self.assertEqual(actual, 17)
def test_should_return_fizzbuzz_with_multiple_of_3_and_5(self): actual = FizzBuzzChecker.is_fizzbuzz(15) self.assertEqual(actual, "FizzBuzz")