def test_copy_02(self): """Tests equivalence of copy.""" p = Tup(1, +Lit('x')) cp = p.copy() self.denyMatch((1,), p) self.denyMatch((1,), cp) self.assertMatch((1,'x',), p) self.assertMatch((1,'x',), cp) self.assertMatch((1,'x','x','x'), p) self.assertMatch((1,'x','x','x'), cp)
def test_callback_01(self): """Tests TuplePatterns with callback-fn.""" l = [] p = Tup(1, 'a')%l.append p.matches((1, 'a')) self.assertListEqual(l, [(1, 'a')])