#NEWLINE# def test_redaction_works( self ) : #NEWLINE# #INDENT# redaction_engine = RedactionEngine ( [ RedactionRule ( 'password=' , 'password=".*"' , 'password="???"' ) , RedactionRule ( 'ssn=' , 'ssn=\\d{3}-\\d{2}-\\d{4}' , 'ssn=XXX-XX-XXXX' ) ] ) #NEWLINE# test_strings = [ ( 'message' , 'message' ) , ( 'password="a password"' , 'password="???"' ) , ( 'before password="a password" after' , 'before password="???" after' ) , ( 'an ssn=123-45-6789' , 'an ssn=XXX-XX-XXXX' ) ] #NEWLINE# for ( message , redacted_message ) in test_strings : #NEWLINE# #INDENT# assert_equal ( redaction_engine . redact ( message ) , redacted_message )