コード例 #1
0
ファイル: MessagingTest.py プロジェクト: carriercomm/Spark-4
 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
ファイル: MessagingTest.py プロジェクト: carriercomm/Spark-4
 def testString(self):
     """ match() should properly match string patterns """
     assertMatch("foo", "foo")
     assertNoMatch("foo", "bar")
コード例 #3
0
ファイル: MessagingTest.py プロジェクト: carriercomm/Spark-4
 def testTuples(self):
     """ match() should properly match tuple patterns """
     assertMatch(("foo", int), ("foo", 1))
     assertNoMatch(("foo", int), ("bar", 1))
コード例 #4
0
ファイル: CoreTest.py プロジェクト: carriercomm/Spark-4
 def testComparingMessages(self):
     assertMatch(Command('foo'), Command('foo'))
     assertNoMatch(Command('foo'), Event('foo'))