Esempio n. 1
0
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")
Esempio n. 2
0
 def test_should_raise_error_with_negative_value(self):
     with self.assertRaises(ValueError):
         FizzBuzzChecker.is_fizzbuzz(-1)
Esempio n. 3
0
 def test_should_raise_error_with_0(self):
     with self.assertRaises(ValueError):
         FizzBuzzChecker.is_fizzbuzz(0)
Esempio n. 4
0
 def test_value_type(self):
     with self.assertRaises(TypeError):
         FizzBuzzChecker.is_fizzbuzz("15")
Esempio n. 5
0
 def test_should_return_alice_number_by_default(self):
     actual = FizzBuzzChecker.is_fizzbuzz(17)
     self.assertEqual(actual, 17)
Esempio n. 6
0
 def test_should_return_fizzbuzz_with_multiple_of_3_and_5(self):
     actual = FizzBuzzChecker.is_fizzbuzz(15)
     self.assertEqual(actual, "FizzBuzz")