2020import contextlib
2121from inspect import Signature
2222
23+ from test .support import ALWAYS_EQ
2324from test .support import import_helper
2425from 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