Skip to content

Commit 7eb90df

Browse files
committed
remove 'fizzbuzz_loop' function for simplicity
1 parent 5cd3254 commit 7eb90df

File tree

2 files changed

+2
-33
lines changed

2 files changed

+2
-33
lines changed

fizzbuzz.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
#!/usr/bin/python3
22

3-
from typing import Iterable
4-
from itertools import count, islice
5-
63

74
def fizzbuzz(num: int) -> str:
85
return ('Fizz' * int(num % 3 == 0) + 'Buzz' * int(num % 5 == 0)) or str(num)
96

107

11-
def fizzbuzz_loop() -> Iterable[str]:
12-
return map(fizzbuzz, count(1))
13-
14-
158
def main() -> None:
16-
for value in islice(fizzbuzz_loop(), 100):
17-
print(value)
9+
for value in range(1, 100 + 1):
10+
print(fizzbuzz(value))
1811

1912

2013
if __name__ == "__main__":

tests/test_fizzbuzz.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import unittest
44
from unittest.mock import call, patch
5-
from itertools import islice
65

76
import fizzbuzz
87

@@ -18,29 +17,6 @@ def test(self):
1817
self.assertEqual(f(15), 'FizzBuzz')
1918

2019

21-
class TestFizzBuzzLoop(unittest.TestCase):
22-
def test(self):
23-
expected = [
24-
'1',
25-
'2',
26-
'Fizz',
27-
'4',
28-
'Buzz',
29-
'Fizz',
30-
'7',
31-
'8',
32-
'Fizz',
33-
'Buzz',
34-
'11',
35-
'Fizz',
36-
'13',
37-
'14',
38-
'FizzBuzz',
39-
]
40-
actual = list(islice(fizzbuzz.fizzbuzz_loop(), len(expected)))
41-
self.assertEqual(expected, actual)
42-
43-
4420
class TestMain(unittest.TestCase):
4521
@patch('fizzbuzz.print')
4622
def test(self, mock_patch):

0 commit comments

Comments
 (0)