From 8cf5aa605801b0ad2dfbe04aa67605d866859d15 Mon Sep 17 00:00:00 2001 From: Joshua Aguayo Date: Wed, 19 Nov 2025 12:40:42 -0700 Subject: [PATCH 1/4] created calc and test-calc .py --- calculator.py | 13 +++++++++++++ tests/test_calculator.py | 15 +++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 calculator.py create mode 100644 tests/test_calculator.py diff --git a/calculator.py b/calculator.py new file mode 100644 index 0000000..cce09d4 --- /dev/null +++ b/calculator.py @@ -0,0 +1,13 @@ +def add(a, b): + """Add two numbers together.""" + return a + b + +def multiply(a, b): + """Multiply two numbers.""" + return a * b + +def divide(a, b): + """Divide two numbers.""" + if b == 0: + raise ValueError("Cannot divide by zero") + return a / b \ No newline at end of file diff --git a/tests/test_calculator.py b/tests/test_calculator.py new file mode 100644 index 0000000..1b2dad8 --- /dev/null +++ b/tests/test_calculator.py @@ -0,0 +1,15 @@ +import pytest +from calculator import add, multiply, divide + +def test_add(): + assert add(2, 3) == 5 + assert add(-1, 1) == 0 + +def test_multiply(): + assert multiply(3, 4) == 12 + assert multiply(0, 5) == 0 + +def test_divide(): + assert divide(10, 2) == 5 + with pytest.raises(ValueError): + divide(10, 0) \ No newline at end of file From e58d1da66ee22015ef85e1d905c3ddd55ff2dc4f Mon Sep 17 00:00:00 2001 From: Joshua Aguayo Date: Wed, 19 Nov 2025 12:47:34 -0700 Subject: [PATCH 2/4] test auto workflow --- tests/test_calculator.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_calculator.py b/tests/test_calculator.py index 1b2dad8..717c5a6 100644 --- a/tests/test_calculator.py +++ b/tests/test_calculator.py @@ -12,4 +12,6 @@ def test_multiply(): def test_divide(): assert divide(10, 2) == 5 with pytest.raises(ValueError): - divide(10, 0) \ No newline at end of file + divide(10, 0) + +#comment for test workflow \ No newline at end of file From 25935bac0aeb5d1b69b26678b38f96b173694416 Mon Sep 17 00:00:00 2001 From: Joshua Aguayo Date: Wed, 19 Nov 2025 13:01:03 -0700 Subject: [PATCH 3/4] Trigger CI --- trigger.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 trigger.txt diff --git a/trigger.txt b/trigger.txt new file mode 100644 index 0000000..e0fbf4a --- /dev/null +++ b/trigger.txt @@ -0,0 +1 @@ +# trigger From dc66126553b68af00de340ba7beb23a604452479 Mon Sep 17 00:00:00 2001 From: Joshua Aguayo Date: Wed, 19 Nov 2025 13:11:01 -0700 Subject: [PATCH 4/4] formatted using black --- calculator.py | 4 +++- tests/test_calculator.py | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/calculator.py b/calculator.py index cce09d4..d0b34fd 100644 --- a/calculator.py +++ b/calculator.py @@ -2,12 +2,14 @@ def add(a, b): """Add two numbers together.""" return a + b + def multiply(a, b): """Multiply two numbers.""" return a * b + def divide(a, b): """Divide two numbers.""" if b == 0: raise ValueError("Cannot divide by zero") - return a / b \ No newline at end of file + return a / b diff --git a/tests/test_calculator.py b/tests/test_calculator.py index 717c5a6..34630df 100644 --- a/tests/test_calculator.py +++ b/tests/test_calculator.py @@ -1,17 +1,21 @@ import pytest from calculator import add, multiply, divide + def test_add(): assert add(2, 3) == 5 assert add(-1, 1) == 0 + def test_multiply(): assert multiply(3, 4) == 12 assert multiply(0, 5) == 0 + def test_divide(): assert divide(10, 2) == 5 with pytest.raises(ValueError): divide(10, 0) -#comment for test workflow \ No newline at end of file + +# comment for test workflow