From 824715efa540f08a77b003e9eba26e885da5f1b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonel=20C=C3=A2mara?= Date: Fri, 13 Aug 2021 15:20:20 +0100 Subject: [PATCH] test for parser within parser --- tests/test_parser.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/test_parser.py diff --git a/tests/test_parser.py b/tests/test_parser.py new file mode 100644 index 0000000..bca7bc8 --- /dev/null +++ b/tests/test_parser.py @@ -0,0 +1,19 @@ +import unittest +from hotxlfp import Parser + + + +class TestParser(unittest.TestCase): + + def test_parser_within_parser(self): + + def parse(formula): + parser = Parser(debug=True) + result = parser.parse(formula) + return result['result'] + + parser = Parser(debug=True) + parser.set_function('EVAL', parse) + first_result = parser.parse('EVAL("1+1")')['result'] + second_result = parser.parse('EVAL("1+1")')['result'] + self.assertEqual(first_result, second_result)