-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.py
More file actions
26 lines (19 loc) · 759 Bytes
/
tests.py
File metadata and controls
26 lines (19 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import unittest
from module import fizzbuzz
class TestFizzBuzz(unittest.TestCase):
def test_multiple_of_3(self):
self.assertEqual(fizzbuzz(9), "fizz")
self.assertEqual(fizzbuzz(-9), "fizz")
def test_multiple_of_5(self):
self.assertEqual(fizzbuzz(10), "buzz")
self.assertEqual(fizzbuzz(-10), "buzz")
def test_multiple_of_3_and_5(self):
self.assertEqual(fizzbuzz(15), "fizzbuzz")
self.assertEqual(fizzbuzz(-15), "fizzbuzz")
def test_neither(self):
self.assertEqual(fizzbuzz(7), "7")
self.assertEqual(fizzbuzz(-7), "-7")
def test_zero(self):
self.assertEqual(fizzbuzz(0), "fizzbuzz") # 0 is divisible by any number
if __name__ == "__main__":
unittest.main()