[3.11] Document use of ANY in test assertions (GH-94060) (GH-115608)

(cherry picked from commit 04005f5021)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
This commit is contained in:
Miss Islington (bot) 2024-02-17 14:24:40 +01:00 committed by GitHub
parent 51b974b0ab
commit a6776cdc53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 0 deletions

View File

@ -2375,6 +2375,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