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:
@@ -253,6 +253,28 @@ class TestBuiltinHelpers(TestUsingMemoryBasedSheerka):
|
||||
# a second time, now that bar is already evaluated
|
||||
assert core.builtin_helpers.ensure_evaluated(context, bar) == foo
|
||||
|
||||
@pytest.mark.parametrize("concept, concepts_parts, expected", [
|
||||
(Concept("foo"), ["where"], 0),
|
||||
(Concept("foo", where="x"), ["where"], 1),
|
||||
(Concept("foo", where="x and y"), ["where"], 2),
|
||||
(Concept("foo", where="x or y"), ["where"], 1),
|
||||
(Concept("foo", where="x or y and z"), ["where"], 2),
|
||||
(Concept("foo", where="not w"), ["where"], 1),
|
||||
(Concept("foo", where=""), ["where"], 0),
|
||||
|
||||
(Concept("foo", pre="x"), ["pre", "where"], 101),
|
||||
(Concept("foo", where="x"), ["pre", "where"], 1),
|
||||
(Concept("foo", where="x and y", pre="z"), ["pre", "where"], 103),
|
||||
|
||||
(Concept("foo", pre="x"), ["pre|where"], 1),
|
||||
(Concept("foo", where="x"), ["pre|where"], 1),
|
||||
(Concept("foo", where="x and y", pre="z"), ["pre|where"], 3),
|
||||
|
||||
])
|
||||
def test_i_can_get_concept_complexity(self, concept, concepts_parts, expected):
|
||||
context = self.get_context()
|
||||
assert core.builtin_helpers.get_concept_complexity(context, concept, concepts_parts) == expected
|
||||
|
||||
# @pytest.mark.parametrize("return_values", [
|
||||
# None,
|
||||
# []
|
||||
|
||||
Reference in New Issue
Block a user