https://github.com/python/cpython/commit/04005f5021a17b191dae319faaadf1c942af3fe9
commit: 04005f5021a17b191dae319faaadf1c942af3fe9
branch: main
author: Thomas Grainger <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2024-02-17T13:13:34Z
summary:

Document use of ANY in test assertions (GH-94060)

files:
M Doc/library/unittest.mock.rst

diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst
index eca20b94ec8e74..b0a5d96c38d375 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

_______________________________________________
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