math-operations-kseahtan 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ Metadata-Version: 2.4
2
+ Name: math_operations_kseahtan
3
+ Version: 1.0.0
4
+ Summary: An interactive terminal calculator with basic and advanced math operations.
5
+ Author: Tan Kim Seah
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: Operating System :: OS Independent
8
+ Requires-Python: >=3.8
9
+ Description-Content-Type: text/markdown
File without changes
@@ -0,0 +1,11 @@
1
+ #math_operations/advanced/__init__.py
2
+ '''
3
+ from .multiply import multiply
4
+ from .divide import divide
5
+ '''
6
+ '''
7
+ from .multiply import multiply #as multiply # Maps file 'mul.py' and function
8
+ # 'mul' to 'multiply'
9
+ from .divide import divide #as divide # Maps file 'div.py' and function
10
+ # 'div' to 'divide'
11
+ '''
@@ -0,0 +1,2 @@
1
+ def divide(a, b):
2
+ return a / b
@@ -0,0 +1,3 @@
1
+ def exponent(base, power):
2
+ """Returns base raised to the power."""
3
+ return base ** power
@@ -0,0 +1,2 @@
1
+ def multiply(a, b):
2
+ return a * b
@@ -0,0 +1,7 @@
1
+ import math
2
+
3
+ def square_root(number):
4
+ """Returns the square root of a number."""
5
+ if number < 0:
6
+ raise ValueError("Cannot calculate the square root of a negative number.")
7
+ return math.sqrt(number)
@@ -0,0 +1,6 @@
1
+ #math_operations/basic/__init__.py
2
+ '''
3
+ from .add import add
4
+ from .subtract import subtract
5
+ '''
6
+
@@ -0,0 +1,2 @@
1
+ def add(a, b):
2
+ return a + b
@@ -0,0 +1,2 @@
1
+ def subtract(a, b):
2
+ return a - b
@@ -0,0 +1,9 @@
1
+ Metadata-Version: 2.4
2
+ Name: math_operations_kseahtan
3
+ Version: 1.0.0
4
+ Summary: An interactive terminal calculator with basic and advanced math operations.
5
+ Author: Tan Kim Seah
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: Operating System :: OS Independent
8
+ Requires-Python: >=3.8
9
+ Description-Content-Type: text/markdown
@@ -0,0 +1,17 @@
1
+ README.md
2
+ pyproject.toml
3
+ setup.cfg
4
+ advanced/__init__.py
5
+ advanced/divide.py
6
+ advanced/exponent.py
7
+ advanced/multiply.py
8
+ advanced/square_root.py
9
+ basic/__init__.py
10
+ basic/add.py
11
+ basic/subtract.py
12
+ math_operations_kseahtan.egg-info/PKG-INFO
13
+ math_operations_kseahtan.egg-info/SOURCES.txt
14
+ math_operations_kseahtan.egg-info/dependency_links.txt
15
+ math_operations_kseahtan.egg-info/entry_points.txt
16
+ math_operations_kseahtan.egg-info/top_level.txt
17
+ tests/test_operations.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ run-calculator = calculate:start_calculator
@@ -0,0 +1,26 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "math_operations_kseahtan"
7
+ version = "1.0.0"
8
+ authors = [
9
+ { name="Tan Kim Seah" }
10
+ ]
11
+ description = "An interactive terminal calculator with basic and advanced math operations."
12
+ readme = "README.md"
13
+ requires-python = ">=3.8"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "Operating System :: OS Independent",
17
+ ]
18
+
19
+ [project.scripts]
20
+ run-calculator = "calculate:start_calculator"
21
+
22
+ [tool.setuptools.packages.find]
23
+ include = ["basic*", "advanced*"]
24
+
25
+
26
+
@@ -0,0 +1,28 @@
1
+ [metadata]
2
+ name = math_operations_kseahtan
3
+ version = 1.0.0
4
+ author = Tan Kim Seah
5
+ description = An interactive terminal calculator with basic and advanced math operations.
6
+ long_description = file: README.md
7
+ long_description_content_type = text/markdown
8
+ classifiers =
9
+ Programming Language :: Python :: 3
10
+ Operating System :: OS Independent
11
+
12
+ [options]
13
+ python_requires = >=3.8
14
+ packages = find:
15
+
16
+ [options.packages.find]
17
+ include =
18
+ basic*
19
+ advanced*
20
+
21
+ [options.entry_points]
22
+ console_scripts =
23
+ run-calculator = calculate:start_calculator
24
+
25
+ [egg_info]
26
+ tag_build =
27
+ tag_date = 0
28
+
@@ -0,0 +1,41 @@
1
+ import unittest
2
+
3
+ from basic.add import add
4
+ from basic.subtract import subtract
5
+ from advanced.multiply import multiply
6
+ from advanced.divide import divide
7
+ from advanced.exponent import exponent
8
+ from advanced.square_root import square_root
9
+
10
+ class TestMathOperations(unittest.TestCase):
11
+
12
+ def test_addition(self):
13
+ self.assertEqual(add(5, 3), 8)
14
+ self.assertEqual(add(-1, 1), 0)
15
+
16
+ def test_subtraction(self):
17
+ self.assertEqual(subtract(10, 4), 6)
18
+ self.assertEqual(subtract(0, 5), -5)
19
+
20
+ def test_multiplication(self):
21
+ self.assertEqual(multiply(3, 4), 12)
22
+ self.assertEqual(multiply(-2, 3), -6)
23
+
24
+ def test_division(self):
25
+ self.assertEqual(divide(10, 2), 5)
26
+ with self.assertRaises(ZeroDivisionError):
27
+ divide(5, 0)
28
+
29
+ def test_exponent(self):
30
+ self.assertEqual(exponent(2, 3), 8)
31
+ self.assertEqual(exponent(5, 0), 1)
32
+
33
+ def test_square_root(self):
34
+ self.assertEqual(square_root(9), 3)
35
+ with self.assertRaises(ValueError):
36
+ square_root(-4)
37
+
38
+ if __name__ == '__main__':
39
+ unittest.main()
40
+
41
+