summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_re.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_re.py')
-rw-r--r--Lib/test/test_re.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index bca2ecf..13fa413 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -1,7 +1,7 @@
import sys
sys.path = ['.'] + sys.path
-from test.test_support import verbose, run_unittest
+from test.test_support import verbose, run_unittest, guard_warnings_filter
import re
from re import Scanner
import sys, os, traceback
@@ -418,6 +418,12 @@ class ReTests(unittest.TestCase):
pass # cPickle not found -- skip it
else:
self.pickle_test(cPickle)
+ # old pickles expect the _compile() reconstructor in sre module
+ import warnings
+ with guard_warnings_filter():
+ warnings.filterwarnings("ignore", "The sre module is deprecated",
+ DeprecationWarning)
+ from sre import _compile
def pickle_test(self, pickle):
oldpat = re.compile('a(?:b|(c|e){1,2}?|d)+?(.)')
@@ -599,6 +605,13 @@ class ReTests(unittest.TestCase):
self.assertEqual(next(iter).span(), (4, 4))
self.assertRaises(StopIteration, next, iter)
+ def test_empty_array(self):
+ # SF buf 1647541
+ import array
+ for typecode in 'cbBuhHiIlLfd':
+ a = array.array(typecode)
+ self.assertEqual(re.compile("bla").match(a), None)
+ self.assertEqual(re.compile("").match(a).groups(), ())
def run_re_tests():
from test.re_tests import benchmarks, tests, SUCCEED, FAIL, SYNTAX_ERROR