@@ -250,10 +250,23 @@ def test_filter_module(self):
250250 self .module .warn_explicit ('msg' , UserWarning , 'filename' , 42 ,
251251 module = 'package.module' )
252252 self .assertEqual (len (w ), 1 )
253+ self .module .warn_explicit ('msg' , UserWarning , '/path/to/package/module' , 42 )
254+ self .assertEqual (len (w ), 2 )
255+ self .module .warn_explicit ('msg' , UserWarning , '/path/to/package/module.py' , 42 )
256+ self .assertEqual (len (w ), 3 )
257+ self .module .warn_explicit ('msg' , UserWarning , '/path/to/package/module/__init__.py' , 42 )
258+ self .assertEqual (len (w ), 4 )
253259 with self .assertRaises (UserWarning ):
254- self .module .warn_explicit ('msg' , UserWarning , '/path/to/package/module' , 42 )
255- with self .assertRaises (UserWarning ):
256- self .module .warn_explicit ('msg' , UserWarning , '/path/to/package/module.py' , 42 )
260+ self .module .warn_explicit ('msg' , UserWarning , '/path/to/package/module/__init__' , 42 )
261+ if MS_WINDOWS :
262+ self .module .warn_explicit ('msg' , UserWarning , r'C:\path\to\package\module.PY' , 42 )
263+ self .assertEqual (len (w ), 5 )
264+ self .module .warn_explicit ('msg' , UserWarning , r'C:\path\to\package\module\__INIT__.PY' , 42 )
265+ self .assertEqual (len (w ), 6 )
266+ self .module .warn_explicit ('msg' , UserWarning , r'C:\path\to\package\module.PYW' , 42 )
267+ self .assertEqual (len (w ), 7 )
268+ self .module .warn_explicit ('msg' , UserWarning , r'C:\path\to\package\module\__INIT__.PYW' , 42 )
269+ self .assertEqual (len (w ), 8 )
257270
258271 with self .module .catch_warnings (record = True ) as w :
259272 self .module .simplefilter ('error' )
@@ -277,9 +290,8 @@ def test_filter_module(self):
277290 with self .assertRaises (UserWarning ):
278291 self .module .warn_explicit ('msg' , UserWarning , '/PATH/TO/PACKAGE/MODULE' , 42 )
279292 if MS_WINDOWS :
280- if self .module is py_warnings :
281- self .module .warn_explicit ('msg' , UserWarning , r'/path/to/package/module.PY' , 42 )
282- self .assertEqual (len (w ), 3 )
293+ self .module .warn_explicit ('msg' , UserWarning , r'/path/to/package/module.PY' , 42 )
294+ self .assertEqual (len (w ), 3 )
283295 with self .assertRaises (UserWarning ):
284296 self .module .warn_explicit ('msg' , UserWarning , r'/path/to/package/module/__init__.py' , 42 )
285297 with self .assertRaises (UserWarning ):
@@ -303,9 +315,8 @@ def test_filter_module(self):
303315 self .assertEqual (len (w ), 1 )
304316 self .module .warn_explicit ('msg' , UserWarning , r'C:\path\to\package\module.py' , 42 )
305317 self .assertEqual (len (w ), 2 )
306- if self .module is py_warnings :
307- self .module .warn_explicit ('msg' , UserWarning , r'C:\path\to\package\module.PY' , 42 )
308- self .assertEqual (len (w ), 3 )
318+ self .module .warn_explicit ('msg' , UserWarning , r'C:\path\to\package\module.PY' , 42 )
319+ self .assertEqual (len (w ), 3 )
309320 with self .assertRaises (UserWarning ):
310321 self .module .warn_explicit ('msg' , UserWarning , r'C:\path\to\package\module.pyw' , 42 )
311322 with self .assertRaises (UserWarning ):
@@ -400,7 +411,7 @@ def test_message_matching(self):
400411
401412 def test_mutate_filter_list (self ):
402413 class X :
403- def match (self , a ):
414+ def match (self , a , start = 0 ):
404415 L [:] = []
405416
406417 L = [("default" ,X (),UserWarning ,X (),0 ) for i in range (2 )]
0 commit comments