New submission from Petter S <petter.strandm...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue35656>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to