def test_the_human_is_undefined(): formula = Iota("x", Call(Var("Human"), Var("x"))) assert interpret_formula(formula, test_model) is None
def test_the_man_is_john(): formula = Iota("x", Call(Var("Man"), Var("x"))) assert interpret_formula(formula, test_model) == John
def test_the_man_is_good_is_true(): formula = Call(Var("Good"), Iota("x", Call(Var("Man"), Var("x")))) assert interpret_formula(formula, test_model)
def test_someone_is_bad_is_true(): formula = Exists("x", Call(Var("Bad"), Var("x"))) assert interpret_formula(formula, test_model)
def test_someone_is_alien_is_false(): formula = Exists("x", Call(Var("Alien"), Var("x"))) assert not interpret_formula(formula, test_model)
def test_everyone_is_bad_is_false(): formula = ForAll("x", Call(Var("Bad"), Var("x"))) assert not interpret_formula(formula, test_model)
def test_everyone_is_human_is_true(): formula = ForAll("x", Call(Var("Human"), Var("x"))) assert interpret_formula(formula, test_model)
def test_mary_is_bad_and_john_is_good_is_true(): formula = And(Call(Var("Bad"), Var("m")), Call(Var("Good"), Var("j"))) assert interpret_formula(formula, test_model)
def test_john_is_bad_is_false(): formula = Call(Var("Bad"), Var("j")) assert not interpret_formula(formula, test_model) assert interpret_formula(Not(formula), test_model)
def test_john_is_good_is_true(): formula = Call(Var("Good"), Var("j")) assert interpret_formula(formula, test_model) assert not interpret_formula(Not(formula), test_model)
def test_john_is_bad_is_false(lexicon): nodes = translate_sentence("John is bad", lexicon) assert len(nodes) == 1 assert not interpret_formula(nodes[0].formula, test_model)
def test_john_is_good_is_true(lexicon): nodes = translate_sentence("John is good", lexicon) assert len(nodes) == 1 assert interpret_formula(nodes[0].formula, test_model)