def test_contradicts_if_present_one_absent(self): shot_fact = Fact( predicate=Predicate(content="$shooter shot $victim"), terms=[Entity(name="Alice"), Entity(name="Bob")], ) shot_false = Fact( predicate=Predicate(content="$shooter shot $victim", truth=False), terms=[Entity(name="Alice"), Entity(name="Bob")], absent=True, ) assert shot_fact._contradicts_if_present(shot_false, ContextRegister()) assert shot_false._contradicts_if_present(shot_fact, ContextRegister())
def test_contradicts_if_present_both_present(self): """ Test a helper function that checks whether there would be a contradiction if neither Factor was "absent". """ shot_fact = Fact( predicate=Predicate(content="$shooter shot $victim"), terms=[Entity(name="Alice"), Entity(name="Bob")], ) shot_false = Fact( predicate=Predicate(content="$shooter shot $victim", truth=False), terms=[Entity(name="Alice"), Entity(name="Bob")], ) assert shot_fact._contradicts_if_present(shot_false, ContextRegister()) assert shot_false._contradicts_if_present(shot_fact, ContextRegister())