Fixed #125: SheerkaErrorManager
Fixed #135: Change services service priorities Fixed #136: ErrorManager: Implement recognize_error Fixed #137: BNFNodeParser : Error when parsing regex with sub parsers Fixed #138: get_last_errors(): real errors sources are lost Fixed #139: OneError return value removes the origin of the error Fixed #140: Concept variables are not correctly handled when parsing sub expression Fixed #143: Implement has_unknown_concepts()
This commit is contained in:
@@ -2,6 +2,7 @@ from dataclasses import dataclass
|
||||
|
||||
import pytest
|
||||
|
||||
from core.builtin_concepts import NotFoundConcept
|
||||
from core.builtin_concepts_ids import BuiltinConcepts
|
||||
from core.concept import Concept
|
||||
from tests.TestUsingMemoryBasedSheerka import TestUsingMemoryBasedSheerka
|
||||
@@ -143,6 +144,28 @@ class TestSheerkaQueryManager(TestUsingMemoryBasedSheerka):
|
||||
res = sheerka.filter_objects(context, lst, mapping=lambda o: o.prop1, predicate="self is a concept")
|
||||
assert res == [lst[1], lst[3]]
|
||||
|
||||
def test_i_can_filter_objects_by_type(self):
|
||||
sheerka, context = self.init_test().unpack()
|
||||
lst = [A("a11", "a12"), Concept("foo"), NotImplementedError(), NotFoundConcept()]
|
||||
|
||||
assert sheerka.filter_objects(context, lst, __type="A") == [lst[0]]
|
||||
assert sheerka.filter_objects(context, lst, __type="foo") == [lst[1]]
|
||||
|
||||
assert sheerka.filter_objects(context, lst, __type="NotImplementedError") == [lst[2]]
|
||||
assert sheerka.filter_objects(context, lst, __type=NotImplementedError) == [lst[2]]
|
||||
|
||||
assert sheerka.filter_objects(context, lst, __type=BuiltinConcepts.NOT_FOUND) == [lst[3]]
|
||||
assert sheerka.filter_objects(context, lst, __type=NotFoundConcept) == [lst[3]]
|
||||
assert sheerka.filter_objects(context, lst, __type="NotFoundConcept") == [lst[3]]
|
||||
|
||||
def test_empty_list_is_returned_when_nothing_is_found(self):
|
||||
sheerka, context = self.init_test().unpack()
|
||||
lst = [A("a11", "a12")]
|
||||
|
||||
assert sheerka.filter_objects(context, lst, __type="foo") == []
|
||||
assert sheerka.filter_objects(context, [], __type="foo") == []
|
||||
assert sheerka.filter_objects(context, lst, predicate="self.name == 'bar'") == []
|
||||
|
||||
def test_i_must_select_object_property_using_string(self):
|
||||
sheerka, context = self.init_test().unpack()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user