more test simplification with assertNoResult
This commit is contained in:
parent
8227d963a3
commit
8a7c6faf4a
|
@ -619,11 +619,9 @@ class WSClientSync(unittest.TestCase):
|
||||||
kwargs["type"] = mtype
|
kwargs["type"] = mtype
|
||||||
c.onMessage(json.dumps(kwargs).encode("utf-8"), False)
|
c.onMessage(json.dumps(kwargs).encode("utf-8"), False)
|
||||||
# no queued messages
|
# no queued messages
|
||||||
sunc = []
|
|
||||||
d = c.sync()
|
d = c.sync()
|
||||||
d.addBoth(sunc.append)
|
|
||||||
self.assertEqual(sent, [("ping", {"ping": 0})])
|
self.assertEqual(sent, [("ping", {"ping": 0})])
|
||||||
self.assertEqual(sunc, [])
|
self.assertNoResult(d)
|
||||||
add("pong", pong=0)
|
add("pong", pong=0)
|
||||||
yield d
|
yield d
|
||||||
self.assertEqual(c.events, [])
|
self.assertEqual(c.events, [])
|
||||||
|
@ -631,9 +629,7 @@ class WSClientSync(unittest.TestCase):
|
||||||
# one,two,ping,pong
|
# one,two,ping,pong
|
||||||
add("one")
|
add("one")
|
||||||
add("two", two=2)
|
add("two", two=2)
|
||||||
sunc = []
|
|
||||||
d = c.sync()
|
d = c.sync()
|
||||||
d.addBoth(sunc.append)
|
|
||||||
add("pong", pong=1)
|
add("pong", pong=1)
|
||||||
yield d
|
yield d
|
||||||
m = yield c.next_non_ack()
|
m = yield c.next_non_ack()
|
||||||
|
@ -644,9 +640,7 @@ class WSClientSync(unittest.TestCase):
|
||||||
|
|
||||||
# one,ping,two,pong
|
# one,ping,two,pong
|
||||||
add("one")
|
add("one")
|
||||||
sunc = []
|
|
||||||
d = c.sync()
|
d = c.sync()
|
||||||
d.addBoth(sunc.append)
|
|
||||||
add("two", two=2)
|
add("two", two=2)
|
||||||
add("pong", pong=2)
|
add("pong", pong=2)
|
||||||
yield d
|
yield d
|
||||||
|
@ -657,9 +651,7 @@ class WSClientSync(unittest.TestCase):
|
||||||
self.assertEqual(c.events, [])
|
self.assertEqual(c.events, [])
|
||||||
|
|
||||||
# ping,one,two,pong
|
# ping,one,two,pong
|
||||||
sunc = []
|
|
||||||
d = c.sync()
|
d = c.sync()
|
||||||
d.addBoth(sunc.append)
|
|
||||||
add("one")
|
add("one")
|
||||||
add("two", two=2)
|
add("two", two=2)
|
||||||
add("pong", pong=3)
|
add("pong", pong=3)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user