@@ -1325,32 +1325,43 @@ def test_inline_flags(self):
13251325 upper_char = '\u1ea0 ' # Latin Capital Letter A with Dot Below
13261326 lower_char = '\u1ea1 ' # Latin Small Letter A with Dot Below
13271327
1328- p = re .compile (upper_char , re .I | re .U )
1329- q = p .match (lower_char )
1328+ p = re .compile ('.' + upper_char , re .I | re .S )
1329+ q = p .match (' \n ' + lower_char )
13301330 self .assertTrue (q )
13311331
1332- p = re .compile (lower_char , re .I | re .U )
1333- q = p .match (upper_char )
1332+ p = re .compile ('.' + lower_char , re .I | re .S )
1333+ q = p .match (' \n ' + upper_char )
13341334 self .assertTrue (q )
13351335
1336- p = re .compile ('(?i)' + upper_char , re .U )
1337- q = p .match (lower_char )
1336+ p = re .compile ('(?i). ' + upper_char , re .S )
1337+ q = p .match (' \n ' + lower_char )
13381338 self .assertTrue (q )
13391339
1340- p = re .compile ('(?i)' + lower_char , re .U )
1341- q = p .match (upper_char )
1340+ p = re .compile ('(?i). ' + lower_char , re .S )
1341+ q = p .match (' \n ' + upper_char )
13421342 self .assertTrue (q )
13431343
1344- p = re .compile ('(?iu) ' + upper_char )
1345- q = p .match (lower_char )
1344+ p = re .compile ('(?is). ' + upper_char )
1345+ q = p .match (' \n ' + lower_char )
13461346 self .assertTrue (q )
13471347
1348- p = re .compile ('(?iu) ' + lower_char )
1349- q = p .match (upper_char )
1348+ p = re .compile ('(?is). ' + lower_char )
1349+ q = p .match (' \n ' + upper_char )
13501350 self .assertTrue (q )
13511351
1352- self .assertTrue (re .match ('(?ixu) ' + upper_char , lower_char ))
1353- self .assertTrue (re .match ('(?ixu) ' + lower_char , upper_char ))
1352+ p = re .compile ('(?s)(?i).' + upper_char )
1353+ q = p .match ('\n ' + lower_char )
1354+ self .assertTrue (q )
1355+
1356+ p = re .compile ('(?s)(?i).' + lower_char )
1357+ q = p .match ('\n ' + upper_char )
1358+ self .assertTrue (q )
1359+
1360+ self .assertTrue (re .match ('(?ix) ' + upper_char , lower_char ))
1361+ self .assertTrue (re .match ('(?ix) ' + lower_char , upper_char ))
1362+ self .assertTrue (re .match (' (?i) ' + upper_char , lower_char , re .X ))
1363+ self .assertTrue (re .match ('(?x) (?i) ' + upper_char , lower_char ))
1364+ self .assertTrue (re .match (' (?x) (?i) ' + upper_char , lower_char , re .X ))
13541365
13551366 p = upper_char + '(?i)'
13561367 with self .assertWarns (DeprecationWarning ) as warns :
@@ -1368,6 +1379,26 @@ def test_inline_flags(self):
13681379 'Flags not at the start of the expression %s (truncated)' % p [:20 ]
13691380 )
13701381
1382+ with self .assertWarns (DeprecationWarning ):
1383+ self .assertTrue (re .match ('(?s).(?i)' + upper_char , '\n ' + lower_char ))
1384+ with self .assertWarns (DeprecationWarning ):
1385+ self .assertTrue (re .match ('(?i) ' + upper_char + ' (?x)' , lower_char ))
1386+ with self .assertWarns (DeprecationWarning ):
1387+ self .assertTrue (re .match (' (?x) (?i) ' + upper_char , lower_char ))
1388+ with self .assertWarns (DeprecationWarning ):
1389+ self .assertTrue (re .match ('^(?i)' + upper_char , lower_char ))
1390+ with self .assertWarns (DeprecationWarning ):
1391+ self .assertTrue (re .match ('$|(?i)' + upper_char , lower_char ))
1392+ with self .assertWarns (DeprecationWarning ):
1393+ self .assertTrue (re .match ('(?:(?i)' + upper_char + ')' , lower_char ))
1394+ with self .assertWarns (DeprecationWarning ):
1395+ self .assertTrue (re .fullmatch ('(^)?(?(1)(?i)' + upper_char + ')' ,
1396+ lower_char ))
1397+ with self .assertWarns (DeprecationWarning ):
1398+ self .assertTrue (re .fullmatch ('($)?(?(1)|(?i)' + upper_char + ')' ,
1399+ lower_char ))
1400+
1401+
13711402 def test_dollar_matches_twice (self ):
13721403 "$ matches the end of string, and just before the terminating \n "
13731404 pattern = re .compile ('$' )
0 commit comments