8000 [3.11] Document use of ANY in test assertions (GH-94060) (GH-115608) · python/cpython@a6776cd · GitHub
[go: up one dir, main page]

Skip to content

Commit a6776cd

Browse files
[3.11] Document use of ANY in test assertions (GH-94060) (GH-115608)
(cherry picked from commit 04005f5) Co-authored-by: Thomas Grainger <tagrain@gmail.com>
1 parent 51b974b commit a6776cd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Doc/library/unittest.mock.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2375,6 +2375,14 @@ passed in.
23752375
>>> m.mock_calls == [call(1), call(1, 2), ANY]
23762376
True
23772377

2378+
:data:`ANY` is not limited to comparisons with call objects and so
2379+
can also be used in test assertions::
2380+
2381+
class TestStringMethods(unittest.TestCase):
2382+
2383+
def test_split(self):
2384+
s = 'hello world'
2385+
self.assertEqual(s.split(), ['hello', ANY])
23782386

23792387

23802388
FILTER_DIR

0 commit comments

Comments
 (0)
0