Skip to content

Commit 8707cf9

Browse files
author
Franziska Geiger
committed
Rework test cases
1 parent 9372ca3 commit 8707cf9

File tree

1 file changed

+14
-11
lines changed
  • graalpython/com.oracle.graal.python.test/src/tests

1 file changed

+14
-11
lines changed

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

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ def test_json_bytes_re_compile():
8282
else:
8383
assert False, "searching a bytes-pattern in a str did not raise"
8484

85+
def test_none_value():
86+
regex_find = re.compile(
87+
r"(//?| ==?)|([[]]+)").findall
88+
stream = iter([ (special,text)
89+
for (special,text) in regex_find('[]')
90+
if special or text ])
91+
n = next(stream)
92+
assert not n[0]
93+
assert str(n[0]) == 'None'
8594

8695
class S(str):
8796
def __getitem__(self, index):
@@ -443,16 +452,10 @@ def test_escaping(self):
443452
def test_escape(self):
444453
self.assertEqual(re.escape(" ()"), "\\ \\(\\)")
445454

446-
def test_none_value():
447-
path_tokenizer = re.compile(
448-
r"(//?| ==?)|([[]]+)"
449-
).findall
450-
451-
stream = iter([ (special,text)
452-
for (special,text) in path_tokenizer('[]')
453-
if special or text ])
455+
def test_finditer_empty_string(self):
456+
regex = re.compile(
457+
r"(//?| ==?)|([[]]+)")
458+
for m in regex.finditer(''):
459+
self.fail()
454460

455-
n = next(stream)
456-
assert not n[0]
457-
assert str(n[0]) == 'None'
458461

0 commit comments

Comments
 (0)