Document use of ANY in test assertions (GH-94060)

This commit is contained in:
Thomas Grainger 2024-02-17 13:13:34 +00:00 committed by GitHub
parent b9a9e3dd62
commit 04005f5021
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 0 deletions

View File

@ -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