Пример #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'))