Antoine Pitrou added the comment:
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), { ... })
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue17063>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com