import math import unittest from numint.input_parser import parse_function, parse_value class InputParserTestCase(unittest.TestCase): def test_common_function(self): expr = "tan(radians(x))" fn = parse_function(expr) tan60 = fn(60) self.assertTrue(abs(tan60 - 1.732) < 0.01) # add assertion here def test_eval_value(self): expr = "e" value = parse_value(expr) self.assertTrue(abs(value - math.e) < 0.0001) if __name__ == '__main__': unittest.main()