Implemented some enhancement requests
This commit is contained in:
@@ -9,7 +9,7 @@ from parsers.BaseNodeParser import utnode, cnode, short_cnode, UnrecognizedToken
|
||||
SCWC, CNC, UTN, SCN, CN
|
||||
from parsers.PythonParser import PythonNode
|
||||
from parsers.SyaNodeParser import SyaNodeParser, SyaConceptParserHelper, SyaAssociativity, \
|
||||
NoneAssociativeSequenceErrorNode, TooManyParametersFound, InFixToPostFix, ParenthesisMismatchErrorNode
|
||||
NoneAssociativeSequenceError, TooManyParametersFoundError, InFixToPostFix, ParenthesisMismatchError
|
||||
|
||||
import tests.parsers.parsers_utils
|
||||
from tests.TestUsingMemoryBasedSheerka import TestUsingMemoryBasedSheerka
|
||||
@@ -758,12 +758,12 @@ class TestSyaNodeParser(TestUsingMemoryBasedSheerka):
|
||||
res = parser.infix_to_postfix(context, ParserInput(expression))
|
||||
|
||||
assert len(res) == 1
|
||||
assert res[0].errors == [ParenthesisMismatchErrorNode(expected)]
|
||||
assert res[0].errors == [ParenthesisMismatchError(expected)]
|
||||
|
||||
def test_i_can_detect_parenthesis_mismatch_error_special_case(self):
|
||||
sheerka, context, parser = self.init_parser()
|
||||
expression = "one ? function( : two"
|
||||
expected = [ParenthesisMismatchErrorNode(("(", 5)), ParenthesisMismatchErrorNode(("(", 5))]
|
||||
expected = [ParenthesisMismatchError(("(", 5)), ParenthesisMismatchError(("(", 5))]
|
||||
res = parser.infix_to_postfix(context, ParserInput(expression))
|
||||
|
||||
assert len(res) == 1
|
||||
@@ -780,7 +780,7 @@ class TestSyaNodeParser(TestUsingMemoryBasedSheerka):
|
||||
assert len(res) == 1
|
||||
assert len(res[0].errors) == 1
|
||||
error = res[0].errors[0]
|
||||
assert isinstance(error, TooManyParametersFound)
|
||||
assert isinstance(error, TooManyParametersFoundError)
|
||||
assert error.concept == cmap[expected[0]]
|
||||
assert error.token.value == expected[1]
|
||||
|
||||
@@ -897,7 +897,7 @@ class TestSyaNodeParser(TestUsingMemoryBasedSheerka):
|
||||
|
||||
res = parser.infix_to_postfix(context, ParserInput("one less than two less than three"))
|
||||
assert len(res) == 1
|
||||
assert res[0].errors == [NoneAssociativeSequenceErrorNode(concepts_map["less than"], 2, 8)]
|
||||
assert res[0].errors == [NoneAssociativeSequenceError(concepts_map["less than"], 2, 8)]
|
||||
|
||||
def test_i_can_post_fix_bnf_definition(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user