Example #1
0
def test_the_human_is_undefined():
    formula = Iota("x", Call(Var("Human"), Var("x")))
    assert interpret_formula(formula, test_model) is None
Example #2
0
def test_the_man_is_john():
    formula = Iota("x", Call(Var("Man"), Var("x")))
    assert interpret_formula(formula, test_model) == John
Example #3
0
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)
Example #4
0
def test_someone_is_bad_is_true():
    formula = Exists("x", Call(Var("Bad"), Var("x")))
    assert interpret_formula(formula, test_model)
Example #5
0
def test_someone_is_alien_is_false():
    formula = Exists("x", Call(Var("Alien"), Var("x")))
    assert not interpret_formula(formula, test_model)
Example #6
0
def test_everyone_is_bad_is_false():
    formula = ForAll("x", Call(Var("Bad"), Var("x")))
    assert not interpret_formula(formula, test_model)
Example #7
0
def test_everyone_is_human_is_true():
    formula = ForAll("x", Call(Var("Human"), Var("x")))
    assert interpret_formula(formula, test_model)
Example #8
0
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)
Example #9
0
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)
Example #10
0
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)
Example #11
0
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)
Example #12
0
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)