@@ -1303,32 +1303,43 @@ def test_inline_flags(self):
1303
1303
upper_char = '\u1ea0 ' # Latin Capital Letter A with Dot Below
1304
1304
lower_char = '\u1ea1 ' # Latin Small Letter A with Dot Below
1305
1305
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 )
1308
1308
self .assertTrue (q )
1309
1309
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 )
1312
1312
self .assertTrue (q )
1313
1313
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 )
1316
1316
self .assertTrue (q )
1317
1317
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 )
1320
1320
self .assertTrue (q )
1321
1321
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 )
1324
1324
self .assertTrue (q )
1325
1325
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 )
1328
1328
self .assertTrue (q )
1329
1329
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 ))
1332
1343
1333
1344
p = upper_char + '(?i)'
1334
1345
with self .assertWarns (DeprecationWarning ) as warns :
@@ -1346,6 +1357,26 @@ def test_inline_flags(self):
1346
1357
'Flags not at the start of the expression %s (truncated)' % p [:20 ]
1347
1358
)
1348
1359
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
+
1349
1380
def test_dollar_matches_twice (self ):
1350
1381
"$ matches the end of string, and just before the terminating \n "
1351
1382
pattern = re .compile ('$' )
0 commit comments