[New-bugs-announce] [issue35656] More matchers in unittest.mock
Petter S
report at bugs.python.org
Fri Jan 4 06:04:51 EST 2019
New submission from Petter S <petter.strandmark at gmail.com>:
The ``ANY`` object in ``unittest.mock`` is also pretty useful when verifying dicts in tests:
self.assertEqual(result, {
"message": "Hi!",
"code": 0,
"id": mock.ANY
})
Then it does not matter what the (presumably randomly generated) id is. For the same use cases, objects like ``APPROXIMATE`` (for approximate floating-point matching) and ``MATCHES`` (taking a boolean lambda) would be pretty useful, I think.
----------
components: Library (Lib)
messages: 332968
nosy: Petter S
priority: normal
severity: normal
status: open
title: More matchers in unittest.mock
type: enhancement
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35656>
_______________________________________
More information about the New-bugs-announce
mailing list