Fixed #100 : SheerkaAdmin: Add builtins() command
Fixed #99 : SheerkaQueryManager: I can manage contains predicate when filtering objects Fixed #97 : ERROR: list indices must be integers or slices, not Concept Fixed #96 : SequenceNodeParser: SequenceNodeParser must correctly handle concept definition Fixed #95 : ResolveAmbiguity must not remove concepts that do not require evaluation Fixed #94 : Concepts with the same key are lost when new ontology Fixed #93 : Introduce BuiltinConcepts.EVAL_GLOBAL_TRUTH_REQUESTED Fixed #92 : ExpressionParser: Implement compile_disjunctions() Fixed #91 : Implement get_concepts_complexity(context, concepts, concept_parts) Fixed #90 : ResolveAmbiguity : where predicate is not used to resolve ambiguity Fixed #89 : ResolveAmbiguityEvaluator: Concepts embedded in ConceptNode are not resolved Fixed #88: SyaNodeParser: Parse multiple parameters when some of the are not recognized Fixed #87: SyaNodeParser : Parse the multiple parameters
This commit is contained in:
@@ -7,6 +7,33 @@ class TestSheerkaHasAManager(TestUsingMemoryBasedSheerka):
|
||||
def test_i_can_set_hasa(self):
|
||||
sheerka, context, king, kingdom = self.init_concepts("king", "kingdom")
|
||||
|
||||
king_instance = sheerka.new("king")
|
||||
res = sheerka.set_hasa(context, king_instance, kingdom)
|
||||
assert res.status
|
||||
|
||||
# when global truth is not activated, only the current instance is modified
|
||||
another_king = sheerka.get_by_key("king")
|
||||
assert not another_king.get_prop(BuiltinConcepts.HASA) == {kingdom}
|
||||
assert not sheerka.hasa(another_king, kingdom)
|
||||
|
||||
def test_i_cannot_set_the_same_attribute_twice(self):
|
||||
sheerka, context, king, kingdom = self.init_concepts("king", "kingdom")
|
||||
|
||||
king_instance = sheerka.new("king")
|
||||
sheerka.set_hasa(context, king_instance, kingdom)
|
||||
res = sheerka.set_hasa(context, king_instance, kingdom)
|
||||
|
||||
assert not res.status
|
||||
assert sheerka.isinstance(res.body, BuiltinConcepts.PROPERTY_ALREADY_DEFINED)
|
||||
assert res.body.property_name == BuiltinConcepts.HASA
|
||||
assert res.body.property_value == kingdom
|
||||
assert res.body.concept == king_instance
|
||||
|
||||
def test_i_can_set_hasa_when_global_truth_is_activated(self):
|
||||
sheerka, context, king, kingdom = self.init_test(global_truth=True).with_concepts(
|
||||
"king",
|
||||
"kingdom").unpack()
|
||||
|
||||
res = sheerka.set_hasa(context, sheerka.new("king"), kingdom)
|
||||
assert res.status
|
||||
|
||||
@@ -16,8 +43,10 @@ class TestSheerkaHasAManager(TestUsingMemoryBasedSheerka):
|
||||
# check that the definition of the concept has been updated
|
||||
assert sheerka.hasa(sheerka.new("king"), kingdom)
|
||||
|
||||
def test_i_cannot_set_the_same_attribute_twice(self):
|
||||
sheerka, context, king, kingdom = self.init_concepts("king", "kingdom")
|
||||
def test_i_cannot_set_the_same_attribute_twice_when_global_truth_is_activated(self):
|
||||
sheerka, context, king, kingdom = self.init_test(global_truth=True).with_concepts(
|
||||
"king",
|
||||
"kingdom").unpack()
|
||||
|
||||
sheerka.set_hasa(context, sheerka.new("king"), kingdom)
|
||||
res = sheerka.set_hasa(context, sheerka.new("king"), kingdom)
|
||||
|
||||
Reference in New Issue
Block a user