Replace catch_warnings with check_warnings when it makes sense. Use assertRaises context manager to simplify some tests.

This commit is contained in:
Florent Xicluna 2010-03-31 22:01:03 +00:00
parent ad59833649
commit 6257a7bbb2
21 changed files with 112 additions and 226 deletions

View file

@ -1,4 +1,4 @@
from test.test_support import verbose, run_unittest
from test.test_support import verbose, run_unittest, import_module
import re
from re import Scanner
import sys, traceback
@ -447,11 +447,8 @@ class ReTests(unittest.TestCase):
import cPickle
self.pickle_test(cPickle)
# old pickles expect the _compile() reconstructor in sre module
import warnings
with warnings.catch_warnings():
warnings.filterwarnings("ignore", "The sre module is deprecated",
DeprecationWarning)
from sre import _compile
import_module("sre", deprecated=True)
from sre import _compile
def pickle_test(self, pickle):
oldpat = re.compile('a(?:b|(c|e){1,2}?|d)+?(.)')