Skip to content

Commit

Permalink
Document use of ANY in test assertions (pythonGH-94060)
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert authored Feb 17, 2024
1 parent b9a9e3d commit 04005f5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Doc/library/unittest.mock.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2426,6 +2426,14 @@ passed in.
>>> m.mock_calls == [call(1), call(1, 2), ANY]
True

:data:`ANY` is not limited to comparisons with call objects and so
can also be used in test assertions::

class TestStringMethods(unittest.TestCase):

def test_split(self):
s = 'hello world'
self.assertEqual(s.split(), ['hello', ANY])


FILTER_DIR
Expand Down

0 comments on commit 04005f5

Please sign in to comment.