Fixed #63 : bug is smart_get_attr
This commit is contained in:
@@ -1403,6 +1403,25 @@ class TestSheerkaConceptManager(TestUsingMemoryBasedSheerka):
|
||||
res = sheerka.smart_get_attr(table_instance, color)
|
||||
assert sheerka.isinstance(res, BuiltinConcepts.NOT_FOUND)
|
||||
|
||||
def test_i_cannot_smart_get_attr_when_attribute_does_not_exist(self):
|
||||
sheerka, context, adjective, color, red, size, table = self.init_concepts("adjective",
|
||||
"color",
|
||||
Concept("red", body="red").auto_init(),
|
||||
"size",
|
||||
"table",
|
||||
create_new=True)
|
||||
sheerka.set_isa(context, color, adjective)
|
||||
sheerka.set_isa(context, red, color)
|
||||
sheerka.set_isa(context, size, adjective)
|
||||
|
||||
table_instance = sheerka.new(table)
|
||||
color_instance = sheerka.new(color, body=red)
|
||||
adjective_instance = sheerka.new(adjective, body=color_instance)
|
||||
sheerka.set_attr(table_instance, adjective, adjective_instance)
|
||||
|
||||
res = sheerka.smart_get_attr(table_instance, size)
|
||||
assert sheerka.isinstance(res, BuiltinConcepts.NOT_FOUND)
|
||||
|
||||
|
||||
class TestSheerkaConceptManagerUsingFileBasedSheerka(TestUsingFileBasedSheerka):
|
||||
def test_i_can_add_several_concepts(self):
|
||||
|
||||
Reference in New Issue
Block a user