File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1636,6 +1636,24 @@ async def name_4():
16361636 pass
16371637 [[]]
16381638
1639+ def test_compile_warnings (self ):
1640+ # See gh-131927
1641+ # Compile warnings originating from the same file and
1642+ # line are now only emitted once.
1643+ with warnings .catch_warnings (record = True ) as caught :
1644+ warnings .simplefilter ("default" )
1645+ compile ('1 is 1' , '<stdin>' , 'eval' )
1646+ compile ('1 is 1' , '<stdin>' , 'eval' )
1647+
1648+ self .assertEqual (len (caught ), 1 )
1649+
1650+ with warnings .catch_warnings (record = True ) as caught :
1651+ warnings .simplefilter ("always" )
1652+ compile ('1 is 1' , '<stdin>' , 'eval' )
1653+ compile ('1 is 1' , '<stdin>' , 'eval' )
1654+
1655+ self .assertEqual (len (caught ), 2 )
1656+
16391657class TestBooleanExpression (unittest .TestCase ):
16401658 class Value :
16411659 def __init__ (self ):
You can’t perform that action at this time.
0 commit comments