Browse Source

added test for new function returning true if math-function is a string as well as corresponding functionality

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

4
src/main/py/read_math_function.py

@ -2,3 +2,7 @@ def read_constant(type, value):
if type != "c":
return False
return value
def is_string(value):
result = isinstance(value, str)
return result

2
src/test/py/test_read_math_function.py

@ -7,6 +7,8 @@ class read_function(unittest.TestCase):
self.assertEqual(read_constant("c", 42), 42)
def test_constant_no_c(self):
self.assertEqual(read_constant("e", "42*e^x"), False)
def test_constant_isstring_true(self):
self.assertEqual(is_string("42*e^x"), True)
if __name__ == '__main__':
unittest.main()
Loading…
Cancel
Save