https://github.com/python/cpython/commit/a6776cdc53cf372318a3b3b3b79afadcc2349a8d commit: a6776cdc53cf372318a3b3b3b79afadcc2349a8d branch: 3.11 author: Miss Islington (bot) <[email protected]> committer: serhiy-storchaka <[email protected]> date: 2024-02-17T13:24:40Z summary:
[3.11] Document use of ANY in test assertions (GH-94060) (GH-115608) (cherry picked from commit 04005f5021a17b191dae319faaadf1c942af3fe9) Co-authored-by: Thomas Grainger <[email protected]> files: M Doc/library/unittest.mock.rst diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst index 75d8a6c9bdee3f..837eb14d4c8114 100644 --- a/Doc/library/unittest.mock.rst +++ b/Doc/library/unittest.mock.rst @@ -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 _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: [email protected]
