fixed #18 : I can evaluate concept
This commit is contained in:
@@ -95,10 +95,10 @@ def test_i_cannot_get_an_attribute_which_is_not_defined():
|
||||
def test_i_can_repr_a_concept():
|
||||
next_id = GetNextId()
|
||||
foo = get_concept("foo", sequence=next_id)
|
||||
assert repr(foo) == "(1001)foo"
|
||||
assert repr(foo) == "(Concept foo#1001)"
|
||||
|
||||
bar = get_concept("bar", pre="is an int", sequence=next_id)
|
||||
assert repr(bar) == "(1002)bar, #pre=is an int"
|
||||
assert repr(bar) == "(Concept bar#1002, #pre=is an int)"
|
||||
|
||||
baz = get_concept("baz", definition="add a b", variables=["a", "b"], sequence=next_id)
|
||||
assert repr(baz) == "(1003)baz, a=**NotInit**, b=**NotInit**"
|
||||
assert repr(baz) == "(Concept baz#1003, a=**NotInit**, b=**NotInit**)"
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
from os import path
|
||||
|
||||
import pytest
|
||||
|
||||
from base import UsingFileBasedSheerka
|
||||
from core.concept import ConceptDefaultProps
|
||||
from helpers import get_concept, get_concepts, get_file_content
|
||||
|
||||
|
||||
@@ -34,3 +37,20 @@ class TestSheerka(UsingFileBasedSheerka):
|
||||
assert not sheerka.isinstance(foo, bar.str_id)
|
||||
assert not sheerka.isinstance(foo, bar)
|
||||
assert not sheerka.isinstance(foo, bar.get_metadata())
|
||||
|
||||
@pytest.mark.parametrize("obj, expected", [
|
||||
(None, None),
|
||||
(1, 1),
|
||||
])
|
||||
def test_i_can_get_obj_value(self, sheerka, context, obj, expected):
|
||||
assert sheerka.objvalue(obj) == expected
|
||||
|
||||
def test_i_can_get_obj_value_for_concept(self, sheerka, context):
|
||||
foo = get_concept("foo")
|
||||
bar = get_concept("bar")
|
||||
bar.set_value(ConceptDefaultProps.BODY, 1)
|
||||
foo.set_value(ConceptDefaultProps.BODY, bar)
|
||||
foo.get_runtime_info().is_evaluated = True
|
||||
bar.get_runtime_info().is_evaluated = True
|
||||
|
||||
assert sheerka.objvalue(foo) == 1
|
||||
|
||||
Reference in New Issue
Block a user