예제 #1
0
 def testMessages(self):
     """ match() should properly match message patterns """
     assertMatch(Request("swap", str, str), Request("swap", "foo", "bar").withID(1))
     assertMatch(Event("listening", None), Event('listening', ('127.0.0.1', 4550)))
     assertMatch(Block, Block(0, 1, 'foo'))
     assertNoMatch(Request("paws"), Request("swap", "foo", "bar").withID(1))
     assertNoMatch(Request("swap", "foo", "bar").withID(1), Request("swap"))
     assertNoMatch(('disconnect', ), Event("protocol-negociated", "SPARKv1"))
예제 #2
0
 def testString(self):
     """ match() should properly match string patterns """
     assertMatch("foo", "foo")
     assertNoMatch("foo", "bar")
예제 #3
0
 def testTuples(self):
     """ match() should properly match tuple patterns """
     assertMatch(("foo", int), ("foo", 1))
     assertNoMatch(("foo", int), ("bar", 1))
예제 #4
0
 def testComparingMessages(self):
     assertMatch(Command('foo'), Command('foo'))
     assertNoMatch(Command('foo'), Event('foo'))