Пример #1
0
 def _do_test(values: List[str], expected: List[Composite]):
     the_filter: Filter = MatchesOneOf(None,
                                       schema,
                                       "t_text",
                                       values=values,
                                       narrows=False)
     f_iter: Callable = InMemoryFilterIterator([the_filter])
     actual: List[Composite] = list(f_iter(composites))
     assert actual == expected
Пример #2
0
    def _do_test(values: List[str], keys: List[Set[str]]):
        expected: List[Composite] = []
        for i, i_keys in enumerate(keys):
            content: Dict = {}
            for key in i_keys:
                content[key] = composites[i].content[key]
            composite: Composite = Composite(
                schema, content, composite_id=composites[i].composite_id)
            expected.append(composite)

        the_filter: Filter = MatchesOneOf(None,
                                          schema,
                                          "t_text",
                                          values,
                                          filters=False)
        f_iter: Callable = InMemoryFilterIterator([the_filter])
        actual: List[Composite] = list(f_iter(composites))
        assert actual == expected