I can also get concept by name
This commit is contained in:
@@ -359,6 +359,30 @@ as:
|
||||
assert evaluated.body == "one two three"
|
||||
assert evaluated.props["a"] == Property("a", sheerka.new(concept_a.key, body="one two").init_key())
|
||||
|
||||
@pytest.mark.parametrize("user_input", [
|
||||
"def concept greetings from def hello a where a",
|
||||
"def concept greetings from hello a where a"])
|
||||
def test_i_can_recognize_a_concept_defined_using_from_def(self, user_input):
|
||||
sheerka = self.get_sheerka()
|
||||
|
||||
greetings = sheerka.evaluate_user_input(user_input)[0].body.body
|
||||
|
||||
res = sheerka.evaluate_user_input("hello 'foo'")
|
||||
assert len(res) == 1
|
||||
assert res[0].status
|
||||
concept_found = res[0].value
|
||||
assert sheerka.isinstance(concept_found, greetings)
|
||||
assert concept_found.get_prop("a") == "foo"
|
||||
assert concept_found.metadata.need_validation
|
||||
|
||||
res = sheerka.evaluate_user_input("greetings")
|
||||
assert len(res) == 1
|
||||
assert res[0].status
|
||||
concept_found = res[0].value
|
||||
assert sheerka.isinstance(concept_found, greetings)
|
||||
assert concept_found.get_prop("a") is None
|
||||
assert not concept_found.metadata.need_validation
|
||||
|
||||
@pytest.mark.parametrize("desc, definitions", [
|
||||
("Simple form", [
|
||||
"def concept one as 1",
|
||||
|
||||
Reference in New Issue
Block a user