From cde4279f6458313ab853e0d3d0f7247f7d316829 Mon Sep 17 00:00:00 2001 From: fdai7783 Date: Sun, 4 Feb 2024 13:42:28 +0100 Subject: [PATCH] change to test and function to also allow reverse detection of disconjunctive identiy --- src/main/py/logical_operations.py | 2 ++ src/test/py/test_logical_operations.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/py/logical_operations.py b/src/main/py/logical_operations.py index 3b519aa..42678a1 100644 --- a/src/main/py/logical_operations.py +++ b/src/main/py/logical_operations.py @@ -1,6 +1,8 @@ def identity_disconjunctive(variable, operator, zero): if zero == 0 and operator == "+": return variable + elif variable == 0 and zero == 1: + return 1 else: return None diff --git a/src/test/py/test_logical_operations.py b/src/test/py/test_logical_operations.py index 302c8e3..4099b13 100644 --- a/src/test/py/test_logical_operations.py +++ b/src/test/py/test_logical_operations.py @@ -16,7 +16,7 @@ class calculationsWithRoots(unittest.TestCase): self.assertEqual(identity_disconjunctive(1, "+", 1), None) def test_disconjunctive_identity_0_or_1_equals_None(self): - self.assertEqual(identity_disconjunctive(0, "+", 1), None) + self.assertEqual(identity_disconjunctive(0, "+", 1), 1) def test_disconjunctive_identity_0_or_0_equals_0(self): self.assertEqual(identity_disconjunctive(0, "+", 0), 0) @@ -30,7 +30,7 @@ class calculationsWithRoots(unittest.TestCase): def test_conjunctive_identity_0_and_1_equals_0(self): self.assertEqual(identity_conjunctive(0, ".", 1), 0) - def test_conjunctive_identity_0_and_1_equals_01(self): + def test_conjunctive_identity_1_and_1_equals_1(self): self.assertEqual(identity_conjunctive(1, ".", 1), 1)