From bbba7507c6cc69a7d6ccc4a0ed755a9be41690bd Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sat, 30 Nov 2019 11:36:58 +0100 Subject: [PATCH] fizzbuzz: add initial executable --- fizzbuzz/fizzbuzz.py | 10 ++++++++++ fizzbuzz/test_fizzbuzz.py | 7 +++++++ 2 files changed, 17 insertions(+) create mode 100755 fizzbuzz/fizzbuzz.py create mode 100644 fizzbuzz/test_fizzbuzz.py diff --git a/fizzbuzz/fizzbuzz.py b/fizzbuzz/fizzbuzz.py new file mode 100755 index 0000000..9452166 --- /dev/null +++ b/fizzbuzz/fizzbuzz.py @@ -0,0 +1,10 @@ +#! /usr/bin/env python + + +def fizzbuzz(max: int = 100) -> None: + for i in range(1, max + 1): + print(i) + + +if __name__ == "__main__": + fizzbuzz() diff --git a/fizzbuzz/test_fizzbuzz.py b/fizzbuzz/test_fizzbuzz.py new file mode 100644 index 0000000..30b304d --- /dev/null +++ b/fizzbuzz/test_fizzbuzz.py @@ -0,0 +1,7 @@ +from fizzbuzz import fizzbuzz + + +def test_fizzbuzz_counts_to_two(capsys): + fizzbuzz(2) + out, __ = capsys.readouterr() + assert out == "1\n2\n"