@@ -619,6 +619,7 @@ def test_re_fullmatch(self):
619619 self .assertEqual (re .fullmatch (r"a.*?b" , "axxb" ).span (), (0 , 4 ))
620620 self .assertIsNone (re .fullmatch (r"a+" , "ab" ))
621621 self .assertIsNone (re .fullmatch (r"abc$" , "abc\n " ))
622+ self .assertIsNone (re .fullmatch (r"abc\z" , "abc\n " ))
622623 self .assertIsNone (re .fullmatch (r"abc\Z" , "abc\n " ))
623624 self .assertIsNone (re .fullmatch (r"(?m)abc$" , "abc\n " ))
624625 self .assertEqual (re .fullmatch (r"ab(?=c)cd" , "abcd" ).span (), (0 , 4 ))
@@ -802,6 +803,8 @@ def test_special_escapes(self):
802803 self .assertEqual (re .search (r"\B(b.)\B" ,
803804 "abc bcd bc abxd" , re .ASCII ).group (1 ), "bx" )
804805 self .assertEqual (re .search (r"^abc$" , "\n abc\n " , re .M ).group (0 ), "abc" )
806+ self .assertEqual (re .search (r"^\Aabc\z$" , "abc" , re .M ).group (0 ), "abc" )
807+ self .assertIsNone (re .search (r"^\Aabc\z$" , "\n abc\n " , re .M ))
805808 self .assertEqual (re .search (r"^\Aabc\Z$" , "abc" , re .M ).group (0 ), "abc" )
806809 self .assertIsNone (re .search (r"^\Aabc\Z$" , "\n abc\n " , re .M ))
807810 self .assertEqual (re .search (br"\b(b.)\b" ,
@@ -813,6 +816,8 @@ def test_special_escapes(self):
813816 self .assertEqual (re .search (br"\B(b.)\B" ,
814817 b"abc bcd bc abxd" , re .LOCALE ).group (1 ), b"bx" )
815818 self .assertEqual (re .search (br"^abc$" , b"\n abc\n " , re .M ).group (0 ), b"abc" )
819+ self .assertEqual (re .search (br"^\Aabc\z$" , b"abc" , re .M ).group (0 ), b"abc" )
820+ self .assertIsNone (re .search (br"^\Aabc\z$" , b"\n abc\n " , re .M ))
816821 self .assertEqual (re .search (br"^\Aabc\Z$" , b"abc" , re .M ).group (0 ), b"abc" )
817822 self .assertIsNone (re .search (br"^\Aabc\Z$" , b"\n abc\n " , re .M ))
818823 self .assertEqual (re .search (r"\d\D\w\W\s\S" ,
@@ -836,7 +841,7 @@ def test_other_escapes(self):
836841 self .assertEqual (re .match (r"[\^a]+" , 'a^' ).group (), 'a^' )
837842 self .assertIsNone (re .match (r"[\^a]+" , 'b' ))
838843 re .purge () # for warnings
839- for c in 'ceghijklmopqyzCEFGHIJKLMNOPQRTVXY ' :
844+ for c in 'ceghijklmopqyCEFGHIJKLMNOPQRTVXY ' :
840845 with self .subTest (c ):
841846 self .assertRaises (re .PatternError , re .compile , '\\ %c' % c )
842847 for c in 'ceghijklmopqyzABCEFGHIJKLMNOPQRTVXYZ' :
@@ -2608,8 +2613,8 @@ def test_findall_atomic_grouping(self):
26082613 self .assertEqual (re .findall (r'(?>(?:ab){1,3})' , 'ababc' ), ['abab' ])
26092614
26102615 def test_bug_gh91616 (self ):
2611- self .assertTrue (re .fullmatch (r'(?s:(?>.*?\.).*)\Z ' , "a.txt" )) # reproducer
2612- self .assertTrue (re .fullmatch (r'(?s:(?=(?P<g0>.*?\.))(?P=g0).*)\Z ' , "a.txt" ))
2616+ self .assertTrue (re .fullmatch (r'(?s:(?>.*?\.).*)\z ' , "a.txt" )) # reproducer
2617+ self .assertTrue (re .fullmatch (r'(?s:(?=(?P<g0>.*?\.))(?P=g0).*)\z ' , "a.txt" ))
26132618
26142619 def test_bug_gh100061 (self ):
26152620 # gh-100061
0 commit comments