def test_phs(self): '''Suggested tests by Dr. Philippe (phs75). ''' ea = LetterAtom('a') eb = LetterAtom('b') zs = StarAtom() a_s = StarAtom('a') bs = StarAtom('b') a_bs = StarAtom('a', 'b') ep = Product() assert ea.contains(zs) assert Product(ea).contains(ep) assert not ea.contains(a_s) assert a_s.contains(ea) assert a_s.contains(zs) assert Product(a_s).contains(ep) assert not a_s.contains(bs) assert not a_s.contains(a_bs) assert not ep.contains(ea) assert not ep.contains(a_s) assert not ep.contains(a_bs) assert not ep.contains(Product(ea, ea)) assert ep.contains(ep) assert ep.contains(zs) assert ep.contains(Product(zs)) assert ep.contains(Product(zs, zs)) assert ea.contains(zs) assert Product(ea).contains(Product(zs, ep, ea, zs)) assert not ea.contains(a_s) assert Product(a_s).contains(Product(ea, a_s)) assert Product(a_s).contains(Product(ea, ep, zs, ea, a_s)) assert Product(a_bs).contains(Product(ea, bs, a_s, bs)) assert not Product(a_s).contains(Product(ea, a_bs, eb))
def test_LetterAtom_naive_entailment_success(self, x): """ Check that two LetterAtoms made with the same message entail each other. """ e1 = LetterAtom(x) e2 = LetterAtom(x) assert e1.contains(e2) & e2.contains(e1)
def test_empty_star_in_letter(self, x): """ Check that the empty StarAtom is in an arbitrary LetterAtom. """ e1 = LetterAtom(x) e2 = StarAtom() assert e1.contains(e2)
def test_Mixed_containment_failure(self, x): """ Check that a LetterAtom cannot contain a StarAtom, and that a StarAtom contains a LetterAtom (when they're made from the same message). """ e1 = LetterAtom(x) e2 = StarAtom(x) assert not e1.contains(e2) assert e2.contains(e1)