@@ -1325,32 +1325,43 @@ def test_inline_flags(self):
1325
1325
upper_char = '\u1ea0 ' # Latin Capital Letter A with Dot Below
1326
1326
lower_char = '\u1ea1 ' # Latin Small Letter A with Dot Below
1327
1327
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 )
1330
1330
self .assertTrue (q )
1331
1331
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 )
1334
1334
self .assertTrue (q )
1335
1335
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 )
1338
1338
self .assertTrue (q )
1339
1339
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 )
1342
1342
self .assertTrue (q )
1343
1343
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 )
1346
1346
self .assertTrue (q )
1347
1347
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 )
1350
1350
self .assertTrue (q )
1351
1351
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 ))
1354
1365
1355
1366
p = upper_char + '(?i)'
1356
1367
with self .assertWarns (DeprecationWarning ) as warns :
@@ -1368,6 +1379,26 @@ def test_inline_flags(self):
1368
1379
'Flags not at the start of the expression %s (truncated)' % p [:20 ]
1369
1380
)
1370
1381
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
+
1371
1402
def test_dollar_matches_twice (self ):
1372
1403
"$ matches the end of string, and just before the terminating \n "
1373
1404
pattern = re .compile ('$' )
0 commit comments