From 1b0eac1845cf58ef856c610acd5d6e6405f19543 Mon Sep 17 00:00:00 2001 From: githubcage Date: Tue, 14 Jan 2020 14:27:43 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=88=98=E9=98=B3=E6=B4=8B-=E7=A7=91?= =?UTF-8?q?=E6=8A=80=E4=BA=8B=E4=B8=9A=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/encodings.xml | 4 ++++ .idea/fizzbuzz-python-tdd-scaffold.iml | 12 ++++++++++++ .idea/misc.xml | 7 +++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ helloworld.py | 7 +++++-- helloworld_test.py | 9 +++++---- 7 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 .idea/encodings.xml create mode 100644 .idea/fizzbuzz-python-tdd-scaffold.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..15a15b2 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/fizzbuzz-python-tdd-scaffold.iml b/.idea/fizzbuzz-python-tdd-scaffold.iml new file mode 100644 index 0000000..7c9d48f --- /dev/null +++ b/.idea/fizzbuzz-python-tdd-scaffold.iml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..8656114 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..890fc34 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/helloworld.py b/helloworld.py index 449b948..c9b4f60 100644 --- a/helloworld.py +++ b/helloworld.py @@ -1,2 +1,5 @@ -def get_greetings(): - return 'Hello World!' +def fb(n): + if n % 15 == 0: return "fizzbuzz" + if n % 3 == 0: return "fizz" + if n % 5 == 0: return "buzz" + return n diff --git a/helloworld_test.py b/helloworld_test.py index 4c27dfe..8664f94 100644 --- a/helloworld_test.py +++ b/helloworld_test.py @@ -1,5 +1,6 @@ -from helloworld import get_greetings +from helloworld import fb - -def test_get_helloworld(): - assert get_greetings() == 'Hello World!' +a = [1, 3, 5, 15] +b = [1, "fizz", "buzz", "fizzbuzz"] +for i in range(len(a)): + assert (fb(a[i]) == b[i]) From 707031114e5240dddf87a0777b09dc864306bda9 Mon Sep 17 00:00:00 2001 From: githubcage Date: Tue, 14 Jan 2020 17:04:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=98=E9=98=B3=E6=B4=8B-=E7=A7=91?= =?UTF-8?q?=E6=8A=80=E4=BA=8B=E4=B8=9A=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/misc.xml | 3 +++ fizzbuzz.py | 8 ++++++++ fizzbuzz_test.py | 6 ++++++ helloworld.py | 7 ++----- helloworld_test.py | 9 ++++----- 5 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 fizzbuzz.py create mode 100644 fizzbuzz_test.py diff --git a/.idea/misc.xml b/.idea/misc.xml index 8656114..ad2f7ff 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,4 +4,7 @@