Message183215
Just got bitten by this again. Context: I have a protocol which is sending JSON datagrams over the wire and I'm checking the sent data. I can't exactly check the JSON-encoded content since dict ordering is undefined. So right now I have to write:
self.assertEqual(q.transport.send.call_count, 1)
(dgram, target), _ = q.transport.send.call_args
self.assertEqual(target, (PEER, PORT))
self.assertEqual(json.loads(dgram), { ... })
Clumsy, clumsy (note that I am too lazy to add a check for the kwargs).
Would be much better if I could simply write:
dgram, = q.tranport.assert_called_once_with(mock.ANY, (PEER, PORT))
self.assertEqual(json.loads(dgram), { ... }) |
|
Date |
User |
Action |
Args |
2013-02-28 12:06:20 | pitrou | set | recipients:
+ pitrou, ezio.melotti, michael.foord |
2013-02-28 12:06:19 | pitrou | set | messageid: <1362053179.97.0.804921948739.issue17063@psf.upfronthosting.co.za> |
2013-02-28 12:06:19 | pitrou | link | issue17063 messages |
2013-02-28 12:06:19 | pitrou | create | |
|