From ea71a5ebb94c24a06ea3cf114bd5b5bcd212f087 Mon Sep 17 00:00:00 2001 From: MariusOzanne Date: Thu, 6 Feb 2025 12:13:01 +0100 Subject: [PATCH 1/4] adding fizzbuzz programm and test for this code --- __init__.py | 0 __pycache__/main.cpython-312.pyc | Bin 0 -> 419 bytes main.py | 17 +++++++++-------- test.py | 19 +++++++++++++++++++ 4 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 __init__.py create mode 100644 __pycache__/main.cpython-312.pyc create mode 100644 test.py diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/__pycache__/main.cpython-312.pyc b/__pycache__/main.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6e9e742231cc733e735eb042f3ff0bfc65686d94 GIT binary patch literal 419 zcmX@j%ge<81Rpz>q+bHkk3k$5V1zP0gOp5XNMUGUh+?Q@)MQGA$$%6vL-FT0u&Nq{ z6viqx28I--Yz+p6B2FNm8HvwW$%3YWv62--4OmRVJmR9aPaiv`5G#R6h$GTve?E-3<0d8N6bE@(~43vV{#KS^YjWTi-1mN023fx#r8m=f#C)_SBGI^=>*26stL(694DqP5S)~A zgJ1FnCr?LUr|1O5E~y**q99&jr}zZNE*T*23BS+; Date: Thu, 6 Feb 2025 14:35:14 +0100 Subject: [PATCH 2/4] Create python-package.yml --- .github/workflows/python-package.yml | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/python-package.yml diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..7b13da7 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,30 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python Test + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: checkout code + uses: actions/checkout@v4 + - name: Set up Python 3.9 + uses: actions/setup-python@v3 + with: + python-version: 3.9 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + - name: Run tests + run: | + python -m unittest test.py + From 4b977019f790f57bcafd7b775a207d28d30aa339 Mon Sep 17 00:00:00 2001 From: MariusOzanne Date: Thu, 6 Feb 2025 14:43:05 +0100 Subject: [PATCH 3/4] ajout du programme fizzbuzz de base --- main.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 2afffac..000dd3a 100644 --- a/main.py +++ b/main.py @@ -6,4 +6,15 @@ def fizzbuzz(num): elif num % 5 == 0: return "buzz" else: - return str(num) \ No newline at end of file + return str(num) + +def main(): + for i in range(1, 101): + if i%3 == 0 and i % 5 == 0: + return "fizzbuzz" + elif i%3 == 0: + return "fizz" + elif i % 5 == 0: + return "buzz" + else: + return str(i) \ No newline at end of file From 42692bd512e9642f897d2bf0e50d90fa5eecb0be Mon Sep 17 00:00:00 2001 From: MariusOzanne Date: Fri, 7 Feb 2025 14:38:18 +0100 Subject: [PATCH 4/4] failed test on purpose --- test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.py b/test.py index a537c61..e73c264 100644 --- a/test.py +++ b/test.py @@ -10,7 +10,7 @@ def test_isBuzz(self): self.assertEqual(fizzbuzz(5), "buzz") def test_isFizzbuzz(self): fizzbuzz(15) - self.assertEqual(fizzbuzz(15), "fizzbuzz") + self.assertEqual(fizzbuzz(15), "fizz") def test_isNumber(self): fizzbuzz(1) self.assertEqual(fizzbuzz(1), "1")