Created
May 5, 2017 16:59
-
-
Save isidore/c7f439ba5578d9ce17165ec05d5a4bc7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from unittest import TestCase | |
def fizzbuzz(i): | |
#FIZZ when number 3 | |
if i % 3 == 0 and i % 5 == 0: | |
return "FIZZBUZZ" | |
if i % 3 == 0: | |
return "FIZZ" | |
if i % 5 == 0: | |
return "BUZZ" | |
return str(i) | |
class FizzBuzzTest(TestCase): | |
def test_1(self): | |
#when we ask for 1 | |
result = fizzbuzz(1) | |
#verify result = 1 | |
self.assertEquals(result,"1") | |
def test_2(self): | |
result = fizzbuzz(2) | |
self.assertEquals(result, "2") | |
def test_3(self): | |
result = fizzbuzz(3) | |
self.assertEquals(result, "FIZZ") | |
def test_5(self): | |
result = fizzbuzz(5) | |
self.assertEquals(result, "BUZZ") | |
def test_6(self): | |
result = fizzbuzz(6) | |
self.assertEquals(result, "FIZZ") | |
def test_10(self): | |
result = fizzbuzz(10) | |
self.assertEquals(result, "BUZZ") | |
def test_15(self): | |
result = fizzbuzz(15) | |
self.assertEquals(result, "FIZZBUZZ") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment