From 7fe410fa1faea9ab3ad61dcb7a7c5eb87fbcbf65 Mon Sep 17 00:00:00 2001 From: Kanyanat Kasetsuntorn Date: Thu, 20 Jan 2022 16:18:35 +0000 Subject: [PATCH 1/3] add division function --- pythoncalculator/divide.py | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 pythoncalculator/divide.py diff --git a/pythoncalculator/divide.py b/pythoncalculator/divide.py new file mode 100644 index 0000000..f548fa0 --- /dev/null +++ b/pythoncalculator/divide.py @@ -0,0 +1,2 @@ +def divide(x, z): + return x / y \ No newline at end of file From ef21368f12c0f1a0e3391ef918e292c409e778b3 Mon Sep 17 00:00:00 2001 From: Kanyanat Kasetsuntorn Date: Thu, 20 Jan 2022 16:12:03 +0000 Subject: [PATCH 2/3] import function in __init__.py --- pythoncalculator/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythoncalculator/__init__.py b/pythoncalculator/__init__.py index c54c73e..51c3974 100644 --- a/pythoncalculator/__init__.py +++ b/pythoncalculator/__init__.py @@ -1,2 +1,2 @@ from .add import add - +from .divide import divide From c6b8bdedaee4b18f787584783fd2a2b51f31fbc2 Mon Sep 17 00:00:00 2001 From: Kanyanat Kasetsuntorn Date: Thu, 20 Jan 2022 16:13:45 +0000 Subject: [PATCH 3/3] add division test --- tests/test_divide.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tests/test_divide.py diff --git a/tests/test_divide.py b/tests/test_divide.py new file mode 100644 index 0000000..a41f86e --- /dev/null +++ b/tests/test_divide.py @@ -0,0 +1,5 @@ +from pythoncalculator import divide + + +def test_divide(): + assert divide(10, 2) == 5 \ No newline at end of file