def test_possible_context_different_terms(self): left = Statement(predicate=self.bird, terms=Entity(name="Foghorn")) right = Statement(predicate=self.bird, terms=Entity(name="Woody")) contexts = list(left.possible_contexts(right)) assert len(contexts) == 1 assert contexts[0].check_match(Entity(name="Foghorn"), Entity(name="Woody"))
def test_all_possible_contexts_identical_factor(self): left = Statement(predicate=self.paid, terms=[Entity(name="Irene"), Entity(name="Bob")]) contexts = list(left.possible_contexts(left)) assert len(contexts) == 2 assert any( context.check_match(Entity(name="Irene"), Entity(name="Bob")) for context in contexts)
def test_limited_possible_contexts_identical_factor(self): statement = Statement(predicate=self.paid, terms=[Entity(name="Al"), Entity(name="Xu")]) context = ContextRegister() context.insert_pair(Entity(name="Al"), Entity(name="Xu")) contexts = list(statement.possible_contexts(statement, context=context)) assert len(contexts) == 1 assert contexts[0].check_match(Entity(name="Al"), Entity(name="Xu")) assert "Entity(name='Xu'" in repr(contexts)
def test_possible_context_without_empty_spaces(self): left = Statement(predicate=self.bird, terms=Entity(name="Owl")) right = Statement(predicate=self.bird, terms=Entity(name="Owl")) contexts = list(left.possible_contexts(right)) assert len(contexts) == 1 assert contexts[0].check_match(Entity(name="Owl"), Entity(name="Owl"))