Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
address comments
  • Loading branch information
wjssz committed Apr 19, 2022
commit 9d0133fb37aa5657043ee0e406379bab9f9bea8d
7 changes: 4 additions & 3 deletions Lib/test/test_pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1413,8 +1413,8 @@ def cleanup():
f.write(b"this is file B\n")
with open(join('dirC', 'fileC'), 'wb') as f:
f.write(b"this is file C\n")
with open(join('dirC', 'novel.txt'), 'w', encoding='ascii') as f:
f.write("this is a novel\n")
with open(join('dirC', 'novel.txt'), 'wb') as f:
f.write(b"this is a novel\n")
with open(join('dirC', 'dirD', 'fileD'), 'wb') as f:
f.write(b"this is file D\n")
os.chmod(join('dirE'), 0)
Expand Down Expand Up @@ -1695,7 +1695,8 @@ def test_rglob_symlink_loop(self):
expect = {'brokenLink',
'dirA', 'dirA/linkC',
'dirB', 'dirB/fileB', 'dirB/linkD',
'dirC', 'dirC/dirD', 'dirC/dirD/fileD', 'dirC/fileC', 'dirC/novel.txt',
'dirC', 'dirC/dirD', 'dirC/dirD/fileD',
'dirC/fileC', 'dirC/novel.txt',
'dirE',
'fileA',
'linkA',
Expand Down
26 changes: 1 addition & 25 deletions Lib/test/test_re.py
Original file line number Diff line number Diff line change
Expand Up @@ -2255,31 +2255,7 @@ def test_findall_atomic_grouping(self):
self.assertEqual(re.findall(r'(?>(?:ab){1,3})', 'ababc'), ['abab'])

def test_bug_gh91616(self):
Comment thread
This conversation was marked as resolved.
# These 3 jumps should use DO_JUMP0() instead of DO_JUMP()

# JUMP_POSS_REPEAT_1
self.assertTrue(re.fullmatch(r'(a*?b){1}+c', "abc"))
self.assertTrue( re.fullmatch(r'(.b|a){1}+c', 'abc'))
self.assertIsNone(re.fullmatch(r'(a|.b){1}+c', 'abc'))
self.assertTrue(re.fullmatch(r'(?:(ab)*+){1}+c', 'abc'))
self.assertTrue(re.fullmatch(r'(?:(ab)?+){1}+c', 'abc'))

# JUMP_POSS_REPEAT_2
self.assertTrue(re.fullmatch(r'(a*?b)*+c', "abc"))
self.assertTrue( re.fullmatch(r'(.b|a)*+c', 'abc'))
self.assertIsNone(re.fullmatch(r'(a|.b)*+c', 'abc'))
self.assertTrue(re.fullmatch(r'(?:(ab)*+)*+c', 'abc'))
self.assertTrue(re.fullmatch(r'(?:(ab)?+)*+c', 'abc'))

# JUMP_ATOMIC_GROUP
self.assertTrue(re.fullmatch(r'(?>a*?b)c', "abc"))
self.assertTrue( re.fullmatch(r'(?>.b|a)c', 'abc'))
self.assertIsNone(re.fullmatch(r'(?>a|.b)c', 'abc'))
self.assertTrue(re.fullmatch(r'(?>(ab)*+)c', 'abc'))
self.assertTrue(re.fullmatch(r'(?>(ab)?+)c', 'abc'))

# test-cases provided by gh-91616
self.assertTrue(re.fullmatch(r'(?s:(?>.*?\.).*)\Z', "a.txt"))
self.assertTrue(re.fullmatch(r'(?s:(?>.*?\.).*)\Z', "a.txt")) # reproducer
self.assertTrue(re.fullmatch(r'(?s:(?=(?P<g0>.*?\.))(?P=g0).*)\Z', "a.txt"))


Expand Down