https://github.com/python/cpython/commit/c726d1cc677d02795473a2aea5c4c66d41490293
commit: c726d1cc677d02795473a2aea5c4c66d41490293
branch: 3.12
author: Miss Islington (bot) <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2024-02-17T13:24:20Z
summary:

[3.12] Document use of ANY in test assertions (GH-94060) (GH-115607)

(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 d11307447b26a3..cb9e7203fc640b 100644
--- a/Doc/library/unittest.mock.rst
+++ b/Doc/library/unittest.mock.rst
@@ -2377,6 +2377,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]

Reply via email to