import unittest
import random
class TestFizzBuzz(unittest.TestCase):
@staticmethod
def fizz_buzz(value=None):
value = value if value is not None else random.randint(0, 100) # - случайное целое число N, A ≤ N ≤ B.
result_dict = {0: value, 1: "fizz", 2: "buzz", 3:"fizzbuzz"}
tmp = 0
if value % 3 == 0:
tmp += 1
if value % 5 == 0:
tmp += 2
print(value, result_dict[tmp])
return result_dict[tmp]
def test_print_integer(self):
self.assertEqual(TestFizzBuzz.fizz_buzz(11), 11)
def test_print_fizz(self):
self.assertEqual(TestFizzBuzz.fizz_buzz(9), "fizz")
def test_print_buzz(self):
self.assertEqual(TestFizzBuzz.fizz_buzz(25), "buzz")
def test_print_fizzbuzz(self):
self.assertEqual(TestFizzBuzz.fizz_buzz(15), "fizzbuzz")
if __name__ == '__main__':
# unittest.main()
for i in range(1, 101):
TestFizzBuzz.fizz_buzz(i)