diff options
author | Thomas Grainger <tagrain@gmail.com> | 2024-02-17 13:13:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-17 13:13:34 (GMT) |
commit | 04005f5021a17b191dae319faaadf1c942af3fe9 (patch) | |
tree | dae7e3f2428425b0193f37f997c7ca25ef51b368 /Doc | |
parent | b9a9e3dd62326b726ad2e8e8efd87ca6327b4019 (diff) | |
download | cpython-04005f5021a17b191dae319faaadf1c942af3fe9.zip cpython-04005f5021a17b191dae319faaadf1c942af3fe9.tar.gz cpython-04005f5021a17b191dae319faaadf1c942af3fe9.tar.bz2 |
Document use of ANY in test assertions (GH-94060)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/unittest.mock.rst | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst index eca20b9..b0a5d96 100644 --- a/Doc/library/unittest.mock.rst +++ b/Doc/library/unittest.mock.rst @@ -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 |