From 51229aebd74bd68b6b063469fe838151f3325e9d Mon Sep 17 00:00:00 2001 From: fdai7783 Date: Sun, 4 Feb 2024 14:12:41 +0100 Subject: [PATCH] Added one_zero functionality and one test for it --- src/main/py/logical_operations.py | 7 +++++++ src/test/py/test_logical_operations.py | 3 +++ 2 files changed, 10 insertions(+) diff --git a/src/main/py/logical_operations.py b/src/main/py/logical_operations.py index 6b3b78a..9edc386 100644 --- a/src/main/py/logical_operations.py +++ b/src/main/py/logical_operations.py @@ -21,3 +21,10 @@ def identity(first_input, operator, second_input): return identity_disconjunctive(first_input, second_input) else: return identity_conjunctive(first_input, second_input) + + +def one_zero(first_input, second_input): + if first_input == 0 and second_input == 0: + return None + else: + return 1 diff --git a/src/test/py/test_logical_operations.py b/src/test/py/test_logical_operations.py index f994cc2..1667909 100644 --- a/src/test/py/test_logical_operations.py +++ b/src/test/py/test_logical_operations.py @@ -33,6 +33,9 @@ class calculationsWithRoots(unittest.TestCase): def test_identity_1_and_1_equals_1(self): self.assertEqual(identity(1, ".", 1), 1) + def test_one_zero_1_or_1_equals_1(self): + self.assertEqual(one_zero(1, 1), 1) + if __name__ == "__main__": unittest.main()