Skip to content

Commit f09c523

Browse files
committed
Disable tests incompatible to versions < 3.6.
1 parent e4a6539 commit f09c523

File tree

1 file changed

+12
-9
lines changed
  • graalpython/com.oracle.graal.python.test/src/tests

1 file changed

+12
-9
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_re.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import re
66
import string
77
import unittest
8+
import sys
89

910

1011
def test_match():
@@ -197,8 +198,6 @@ def test_symbolic_groups(self):
197198
self.checkPatternError(r'(?P<a>)(?P<a>)',
198199
"redefinition of group name 'a' as group 2; "
199200
"was group 1")
200-
self.checkPatternError(r'(?P<a>(?P=a))',
201-
"cannot refer to an open group", 10)
202201
self.checkPatternError(r'(?Pxy)', 'unknown extension ?Px')
203202
self.checkPatternError(r'(?P<a>)(?P=a', 'missing ), unterminated name', 11)
204203
self.checkPatternError(r'(?P=', 'missing group name', 4)
@@ -216,7 +215,6 @@ def test_symbolic_groups(self):
216215
self.checkPatternError(r'(?(', 'missing group name', 3)
217216
self.checkPatternError(r'(?())', 'missing group name', 3)
218217
self.checkPatternError(r'(?(a))', "unknown group name 'a'", 3)
219-
self.checkPatternError(r'(?(-1))', "bad character in group name '-1'", 3)
220218
self.checkPatternError(r'(?(1a))', "bad character in group name '1a'", 3)
221219
self.checkPatternError(r'(?(a.))', "bad character in group name 'a.'", 3)
222220
# New valid/invalid identifiers in Python 3
@@ -227,7 +225,11 @@ def test_symbolic_groups(self):
227225
# Support > 100 groups.
228226
pat = '|'.join('x(?P<a%d>%x)y' % (i, i) for i in range(1, 200 + 1))
229227
pat = '(?:%s)(?(200)z|t)' % pat
230-
self.assertEqual(re.match(pat, 'xc8yz').span(), (0, 5))
228+
if sys.version_info.minor >= 6:
229+
self.checkPatternError(r'(?P<a>(?P=a))',
230+
"cannot refer to an open group", 10)
231+
self.checkPatternError(r'(?(-1))', "bad character in group name '-1'", 3)
232+
self.assertEqual(re.match(pat, 'xc8yz').span(), (0, 5))
231233

232234
def test_ignore_case_set(self):
233235
self.assertTrue(re.match(r'[19A]', 'A', re.I))
@@ -243,11 +245,12 @@ def test_ignore_case_set(self):
243245
self.assertTrue(re.match(r'[19k]', '\u212a', re.I))
244246
self.assertTrue(re.match(r'[19\u212a]', 'K', re.I))
245247
self.assertTrue(re.match(r'[19\u212a]', 'k', re.I))
246-
assert '\u017f'.upper() == 'S' # 'ſ'
247-
self.assertTrue(re.match(r'[19S]', '\u017f', re.I))
248-
self.assertTrue(re.match(r'[19s]', '\u017f', re.I))
249-
self.assertTrue(re.match(r'[19\u017f]', 'S', re.I))
250-
self.assertTrue(re.match(r'[19\u017f]', 's', re.I))
248+
if sys.version_info.minor >= 6:
249+
assert '\u017f'.upper() == 'S' # 'ſ'
250+
self.assertTrue(re.match(r'[19S]', '\u017f', re.I))
251+
self.assertTrue(re.match(r'[19s]', '\u017f', re.I))
252+
self.assertTrue(re.match(r'[19\u017f]', 'S', re.I))
253+
self.assertTrue(re.match(r'[19\u017f]', 's', re.I))
251254
assert '\ufb05'.upper() == '\ufb06'.upper() == 'ST' # 'ſt', 'st'
252255
# self.assertTrue(re.match(r'[19\ufb05]', '\ufb06', re.I))
253256
# self.assertTrue(re.match(r'[19\ufb06]', '\ufb05', re.I))

0 commit comments

Comments
 (0)