Skip to content

Commit 38ff471

Browse files
committed
Use ALWAYS_EQ instead of ANY
1 parent 5e151aa commit 38ff471

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Lib/test/test_functools.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import contextlib
2121
from inspect import Signature
2222

23+
from test.support import ALWAYS_EQ
2324
from test.support import import_helper
2425
from test.support import threading_helper
2526

@@ -235,10 +236,10 @@ def test_placeholders(self):
235236
self.assertEqual(actual_kwds, {})
236237
# Checks via `is` and not `eq`
237238
# thus unittest.mock.ANY isn't treated as Placeholder
238-
p = self.partial(capture, unittest.mock.ANY)
239+
p = self.partial(capture, ALWAYS_EQ)
239240
actual_args, actual_kwds = p()
240241
self.assertEqual(len(actual_args), 1)
241-
self.assertIs(actual_args[0], unittest.mock.ANY)
242+
self.assertIs(actual_args[0], ALWAYS_EQ)
242243
self.assertEqual(actual_kwds, {})
243244

244245
def test_placeholders_optimization(self):
@@ -261,10 +262,11 @@ def test_placeholders_kw_restriction(self):
261262
with self.assertRaisesRegex(TypeError, "Placeholder"):
262263
self.partial(capture, a=PH)
263264
# Passes, as checks via `is` and not `eq`
264-
p = self.partial(capture, a=unittest.mock.ANY)
265+
p = self.partial(capture, a=ALWAYS_EQ)
265266
actual_args, actual_kwds = p()
266267
self.assertEqual(actual_args, ())
267-
self.assertEqual(actual_kwds, {'a': unittest.mock.ANY})
268+
self.assertEqual(len(actual_kwds), 1)
269+
self.assertIs(actual_kwds['a'], ALWAYS_EQ)
268270

269271
def test_construct_placeholder_singleton(self):
270272
PH = self.module.Placeholder

0 commit comments

Comments
 (0)