#NEWLINE# def test_complex_override_warning( self ) : #NEWLINE# #INDENT# 'Regression test for #19031' #NEWLINE# with warnings . catch_warnings ( record = True ) as w : #NEWLINE# #INDENT# warnings . simplefilter ( 'always' ) #NEWLINE# with override_settings ( TEST_WARN = 'override' ) : #NEWLINE# #INDENT# self . assertEqual ( settings . TEST_WARN , 'override' ) #NEWLINE# #UNINDENT# self . assertEqual ( len ( w ) , 1 ) #NEWLINE# self . assertEqual ( os . path . splitext ( w [ 0 ] . filename ) [ 0 ] , os . path . splitext ( __file__ ) [ 0 ] ) #NEWLINE# self . assertEqual ( str ( self [ 0 ] . message ) , 'Overriding setting TEST_WARN can lead to unexpected behavior.' )