@@ -1303,32 +1303,43 @@ def test_inline_flags(self):
13031303 upper_char = '\u1ea0 ' # Latin Capital Letter A with Dot Below
13041304 lower_char = '\u1ea1 ' # Latin Small Letter A with Dot Below
13051305
1306- p = re .compile (upper_char , re .I | re .U )
1307- q = p .match (lower_char )
1306+ p = re .compile ('.' + upper_char , re .I | re .S )
1307+ q = p .match (' \n ' + lower_char )
13081308 self .assertTrue (q )
13091309
1310- p = re .compile (lower_char , re .I | re .U )
1311- q = p .match (upper_char )
1310+ p = re .compile ('.' + lower_char , re .I | re .S )
1311+ q = p .match (' \n ' + upper_char )
13121312 self .assertTrue (q )
13131313
1314- p = re .compile ('(?i)' + upper_char , re .U )
1315- q = p .match (lower_char )
1314+ p = re .compile ('(?i). ' + upper_char , re .S )
1315+ q = p .match (' \n ' + lower_char )
13161316 self .assertTrue (q )
13171317
1318- p = re .compile ('(?i)' + lower_char , re .U )
1319- q = p .match (upper_char )
1318+ p = re .compile ('(?i). ' + lower_char , re .S )
1319+ q = p .match (' \n ' + upper_char )
13201320 self .assertTrue (q )
13211321
1322- p = re .compile ('(?iu) ' + upper_char )
1323- q = p .match (lower_char )
1322+ p = re .compile ('(?is). ' + upper_char )
1323+ q = p .match (' \n ' + lower_char )
13241324 self .assertTrue (q )
13251325
1326- p = re .compile ('(?iu) ' + lower_char )
1327- q = p .match (upper_char )
1326+ p = re .compile ('(?is). ' + lower_char )
1327+ q = p .match (' \n ' + upper_char )
13281328 self .assertTrue (q )
13291329
1330- self .assertTrue (re .match ('(?ixu) ' + upper_char , lower_char ))
1331- self .assertTrue (re .match ('(?ixu) ' + lower_char , upper_char ))
1330+ p = re .compile ('(?s)(?i).' + upper_char )
1331+ q = p .match ('\n ' + lower_char )
1332+ self .assertTrue (q )
1333+
1334+ p = re .compile ('(?s)(?i).' + lower_char )
1335+ q = p .match ('\n ' + upper_char )
1336+ self .assertTrue (q )
1337+
1338+ self .assertTrue (re .match ('(?ix) ' + upper_char , lower_char ))
1339+ self .assertTrue (re .match ('(?ix) ' + lower_char , upper_char ))
1340+ self .assertTrue (re .match (' (?i) ' + upper_char , lower_char , re .X ))
1341+ self .assertTrue (re .match ('(?x) (?i) ' + upper_char , lower_char ))
1342+ self .assertTrue (re .match (' (?x) (?i) ' + upper_char , lower_char , re .X ))
13321343
13331344 p = upper_char + '(?i)'
13341345 with self .assertWarns (DeprecationWarning ) as warns :
@@ -1346,6 +1357,26 @@ def test_inline_flags(self):
13461357 'Flags not at the start of the expression %s (truncated)' % p [:20 ]
13471358 )
13481359
1360+ with self .assertWarns (DeprecationWarning ):
1361+ self .assertTrue (re .match ('(?s).(?i)' + upper_char , '\n ' + lower_char ))
1362+ with self .assertWarns (DeprecationWarning ):
1363+ self .assertTrue (re .match ('(?i) ' + upper_char + ' (?x)' , lower_char ))
1364+ with self .assertWarns (DeprecationWarning ):
1365+ self .assertTrue (re .match (' (?x) (?i) ' + upper_char , lower_char ))
1366+ with self .assertWarns (DeprecationWarning ):
1367+ self .assertTrue (re .match ('^(?i)' + upper_char , lower_char ))
1368+ with self .assertWarns (DeprecationWarning ):
1369+ self .assertTrue (re .match ('$|(?i)' + upper_char , lower_char ))
1370+ with self .assertWarns (DeprecationWarning ):
1371+ self .assertTrue (re .match ('(?:(?i)' + upper_char + ')' , lower_char ))
1372+ with self .assertWarns (DeprecationWarning ):
1373+ self .assertTrue (re .fullmatch ('(^)?(?(1)(?i)' + upper_char + ')' ,
1374+ lower_char ))
1375+ with self .assertWarns (DeprecationWarning ):
1376+ self .assertTrue (re .fullmatch ('($)?(?(1)|(?i)' + upper_char + ')' ,
1377+ lower_char ))
1378+
1379+
13491380 def test_dollar_matches_twice (self ):
13501381 "$ matches the end of string, and just before the terminating \n "
13511382 pattern = re .compile ('$' )
0 commit comments