Browse Source

added test for returning "False" if type isn't constant as well as corresponding functionality

remotes/origin/feature/feature-read-math-functions
fdai7763 11 months ago
parent
commit
660529193b
  1. 2
      src/main/py/read_math_function.py
  2. 2
      src/test/py/test_read_math_function.py

2
src/main/py/read_math_function.py

@ -1,2 +1,4 @@
def read_constant(type, value):
if type != "c":
value = False
return value

2
src/test/py/test_read_math_function.py

@ -5,6 +5,8 @@ from src.main.py.read_math_function import *
class read_function(unittest.TestCase):
def test_constant_without_calculation(self):
self.assertEqual(read_constant("c", 42), 42)
def test_constant_no_c(self):
self.assertEqual(read_constant("e", "42*e^x"), False)
if __name__ == '__main__':
unittest.main()
Loading…
Cancel
Save