Fixed #9 : I can parse 'def concept'
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import pytest
|
||||
|
||||
from base import BaseTest
|
||||
from base import BaseParserTest
|
||||
from core.BuiltinConcepts import BuiltinConcepts
|
||||
from core.error import ErrorContext
|
||||
from evaluators.PythonParser import PythonParser
|
||||
@@ -8,7 +8,7 @@ from helpers import _rv, _rvf
|
||||
from parsers.ParserInput import ParserInput
|
||||
|
||||
|
||||
class TestPythonParser(BaseTest):
|
||||
class TestPythonParser(BaseParserTest):
|
||||
@pytest.fixture()
|
||||
def evaluator(self, sheerka):
|
||||
return sheerka.evaluators[PythonParser.NAME]
|
||||
@@ -28,9 +28,7 @@ class TestPythonParser(BaseTest):
|
||||
"a = 20"
|
||||
])
|
||||
def test_i_can_parse_python(self, sheerka, context, evaluator, text):
|
||||
pi = ParserInput(text)
|
||||
pi.init()
|
||||
start = _rv(sheerka.newn(BuiltinConcepts.PARSER_INPUT, pi=pi))
|
||||
start = self.get_parser_input(context, text)
|
||||
|
||||
res = evaluator.eval(context, None, start)
|
||||
|
||||
@@ -43,9 +41,7 @@ class TestPythonParser(BaseTest):
|
||||
|
||||
def test_invalid_python_are_rejected(self, sheerka, context, evaluator):
|
||||
text = "1 + "
|
||||
pi = ParserInput(text)
|
||||
pi.init()
|
||||
start = _rv(sheerka.newn(BuiltinConcepts.PARSER_INPUT, pi=pi))
|
||||
start = self.get_parser_input(context, text)
|
||||
|
||||
res = evaluator.eval(context, None, start)
|
||||
|
||||
@@ -57,9 +53,7 @@ class TestPythonParser(BaseTest):
|
||||
assert ret_val.parents == [start]
|
||||
|
||||
def test_i_can_detect_concepts(self, sheerka, context, evaluator):
|
||||
pi = ParserInput("c:one: + c:two:")
|
||||
pi.init()
|
||||
start = _rv(sheerka.newn(BuiltinConcepts.PARSER_INPUT, pi=pi))
|
||||
start = self.get_parser_input(context, "c:one: + c:two:")
|
||||
|
||||
res = evaluator.eval(context, None, start)
|
||||
|
||||
@@ -72,4 +66,3 @@ class TestPythonParser(BaseTest):
|
||||
assert len(ret_val.value.pf.namespace) == 2
|
||||
assert ret_val.value.pf.namespace["__C__KEY_one__ID_00None00__C__"].value == ("one", None)
|
||||
assert ret_val.value.pf.namespace["__C__KEY_two__ID_00None00__C__"].value == ("two", None)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user