Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ----------- tasks/fizzbuzz.py ------------------
- def checkio(number: int) -> str:
- res = str(number)
- if number % 15 == 0:
- res = "Fizz Buzz"
- elif number % 5 == 0:
- res = "Buzz"
- elif number % 3 == 0:
- res = "Fizz"
- return res
- # ------------- tests/test_fizzbuzz.py --------------------
- from tasks.fizzbuzz import checkio
- def test_fizzbuzz():
- assert checkio(15) == "Fizz Buzz", "15 is divisible by 3 and 5"
- assert checkio(6) == "Fizz", "6 is divisible by 3"
- assert checkio(5) == "Buzz", "5 is divisible by 5"
- assert checkio(7) == "7", "7 is not divisible by 3 or 5"
- def test_fizzbuzz_1():
- assert checkio(15) == "Fizz Buzz", "15 is divisible by 3 and 5"
- def test_fizzbuzz_2():
- assert checkio(6) == "Fizz", "6 is divisible by 3"
- def test_fizzbuzz_3():
- assert checkio(5) == "Buzz", "5 is divisible by 5"
- def test_fizzbuzz_4():
- assert checkio(7) == "7", "7 is not divisible by 3 or 5"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement