@@ -1537,6 +1537,10 @@ def test_set_operations(self):
15371537 with warnings .catch_warnings ():
15381538 warnings .simplefilter ('error' , FutureWarning )
15391539 re .compile (r'[a-z--[aeiou]]' )
1540+ # A reserved construct inside a nested operand warns against the caller.
1541+ with self .assertWarnsRegex (FutureWarning , 'Possible nested set ' ) as w :
1542+ re .compile (r'[\w--[[:digit:]]]' )
1543+ self .assertEqual (w .filename , __file__ )
15401544
15411545 # Set union A||B == A or B (an explicit form of [AB]); flat operands
15421546 # merge into one charset, otherwise the operations are alternated.
@@ -1557,6 +1561,10 @@ def test_set_operations(self):
15571561 self .assertEqual (re .findall (r'[\d~~1]' , s ), list ('0123456789~' ))
15581562 self .assertEqual (w .filename , __file__ )
15591563 self .assertEqual (re .findall (r'[~~1]' , s ), list ('1~' ))
1564+ with self .assertWarnsRegex (FutureWarning ,
1565+ 'Possible set symmetric difference ' ) as w :
1566+ re .compile (r'[\w--[\d~~1]]' )
1567+ self .assertEqual (w .filename , __file__ )
15601568
15611569 def test_search_coverage (self ):
15621570 self .assertEqual (re .search (r"\s(b)" , " b" ).group (1 ), "b" )
0 commit comments