Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def clean(self, text, **kwargs):
if 'replace_with' in kwargs:
scrubadub.filth.base.Filth.lookup = scrubadub.utils.Lookup()
return scrubadub.clean(text, **kwargs)
def test_customize_filth_identification(self):
"""
BEFORE: contact Joe Duffy at joe@example.com
AFTER: contact <b>NAME</b> <b>NAME</b> at <b>EMAIL</b>
"""
before, after = self.get_before_after()
import scrubadub
prefix = scrubadub.filth.base.Filth.prefix
suffix = scrubadub.filth.base.Filth.suffix
scrubadub.filth.base.Filth.prefix = u'<b>'
scrubadub.filth.base.Filth.suffix = u'</b>'
scrubber = scrubadub.Scrubber()
self.check_equal(after, scrubber.clean(before))
scrubadub.filth.base.Filth.prefix = prefix
scrubadub.filth.base.Filth.suffix = suffix