Working on #98 : Persist attribute value when global_truth is set to true
This commit is contained in:
@@ -5,7 +5,7 @@ from core.concept import Concept, DEFINITION_TYPE_DEF
|
||||
from core.sheerka.services.SheerkaExecute import ParserInput
|
||||
from parsers.SequenceNodeParser import SequenceNodeParser
|
||||
from tests.TestUsingMemoryBasedSheerka import TestUsingMemoryBasedSheerka
|
||||
from tests.parsers.parsers_utils import compute_expected_array, CN, CNC, SCN, get_test_obj, compare_with_test_object, \
|
||||
from tests.parsers.parsers_utils import compute_expected_array, CN, SCN, get_test_obj, compare_with_test_object, \
|
||||
UTN
|
||||
|
||||
|
||||
@@ -275,6 +275,26 @@ class TestSequenceNodeParser(TestUsingMemoryBasedSheerka):
|
||||
assert concept_found.get_hints().is_evaluated
|
||||
assert not concept_found.get_hints().is_instance
|
||||
|
||||
def test_i_can_parse_when_variable_is_not_a_parameter(self):
|
||||
concepts_map = {
|
||||
"foo": Concept("foo").def_var("a"), # 'a' is not a parameter (but a property like its color for ex)
|
||||
}
|
||||
|
||||
text, expected = "foo", ["foo"]
|
||||
sheerka, context, parser = self.init_parser(concepts_map, create_new=True, use_sheerka=True)
|
||||
res = parser.parse(context, ParserInput(text))
|
||||
wrapper = res.body
|
||||
lexer_nodes = res.body.body
|
||||
|
||||
assert res.status
|
||||
|
||||
expected_array = compute_expected_array(concepts_map, text, expected)
|
||||
assert sheerka.isinstance(wrapper, BuiltinConcepts.PARSER_RESULT)
|
||||
compare_with_test_object(lexer_nodes, expected_array)
|
||||
assert not lexer_nodes[0].concept.get_hints().is_evaluated
|
||||
assert lexer_nodes[0].concept.get_hints().use_copy
|
||||
assert lexer_nodes[0].concept.get_hints().is_instance
|
||||
|
||||
@pytest.mark.parametrize("text", [
|
||||
"foo",
|
||||
f"foo one",
|
||||
|
||||
Reference in New Issue
Block a user