Beispiel #1
0
 def test_false_does_not_contradict_absent(self):
     absent_fact = Statement(
         predicate=Predicate(
             content="${rural_s_telephone_directory} was copyrightable",
             truth=True),
         terms=[Entity(name="Rural's telephone directory")],
         absent=True,
     )
     false_fact = Statement(
         predicate=Predicate(content="${the_java_api} was copyrightable",
                             truth=False),
         terms=[Entity(name="the Java API", generic=True, plural=False)],
         absent=False,
     )
     assert not false_fact.contradicts(absent_fact)
     assert not absent_fact.contradicts(false_fact)
Beispiel #2
0
 def test_inconsistent_statements_about_different_entities(self):
     """
     Alice and Bob are both generics. So it's possible to reach a
     contradiction if you assume they correspond to one another.
     """
     p_small_weight = Comparison(
         content="the amount of gold $person possessed was",
         sign="<",
         expression=Q_("1 gram"),
     )
     p_large_weight = Comparison(
         content="the amount of gold $person possessed was",
         sign=">=",
         expression=Q_("100 kilograms"),
     )
     alice = Entity(name="Alice")
     bob = Entity(name="Bob")
     alice_rich = Statement(predicate=p_large_weight, terms=alice)
     bob_poor = Statement(predicate=p_small_weight, terms=bob)
     assert alice_rich.contradicts(bob_poor)
Beispiel #3
0
 def test_inconsistent_statements_about_corresponding_entities(self):
     """
     Even though Alice and Bob are both generics, it's known that
     Alice in the first context corresponds with Alice in the second.
     So there's no contradiction.
     """
     p_small_weight = Comparison(
         content="the amount of gold $person possessed was",
         sign="<",
         expression=Q_("1 gram"),
     )
     p_large_weight = Comparison(
         content="the amount of gold $person possessed was",
         sign=">=",
         expression=Q_("100 kilograms"),
     )
     alice = Entity(name="Alice")
     bob = Entity(name="Bob")
     alice_rich = Statement(predicate=p_large_weight, terms=alice)
     bob_poor = Statement(predicate=p_small_weight, terms=bob)
     register = ContextRegister()
     register.insert_pair(alice, alice)
     assert not alice_rich.contradicts(bob_poor, context=register)