Files
Sheerka-Old/tests/non_reg/test_sheerka_non_reg2.py
T
kodjo e69745adc8 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
2021-07-31 08:52:00 +02:00

47 lines
1.6 KiB
Python

from tests.TestUsingMemoryBasedSheerka import TestUsingMemoryBasedSheerka
class TestSheerkaNonRegMemory2(TestUsingMemoryBasedSheerka):
def test_i_can_select_the_correct_concept_when_ambiguity(self):
init = [
"def concept foo",
"def concept x is a y pre is_question() as isa(x,y)",
"def concept x is a foo pre is_question() as isinstance(x, foo)",
]
sheerka = self.init_scenario(init)
res = sheerka.evaluate_user_input("question(foo is a foo)")
assert len(res) == 1
assert res[0].status
assert res[0].value # value is True since 'x is a foo' was chosen
def test_i_can_select_the_correct_concept_vs_bnf(self):
init = [
"def concept one as 1",
"def concept two as 2",
"def concept twenties from bnf 'twenty' (one|two)=unit as 20 + unit",
"def concept twenty two as 'specific occurrence'",
]
sheerka = self.init_scenario(init)
res = sheerka.evaluate_user_input("eval twenty one")
assert res[0].value == 21
res = sheerka.evaluate_user_input("eval twenty two")
assert res[0].value == "specific occurrence" # thanks to ExactConceptParser
def test_i_can_use_global_truth_when_calling_a_concept(self):
init = [
"def concept one",
"def concept number",
"def concept x is a y as set_isa(x, y)",
]
sheerka = self.init_scenario(init)
res = sheerka.evaluate_user_input("global_truth(one is a number)")
assert res[0].status
assert sheerka.isa(sheerka.new("one"), sheerka.new("number"))