Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_disallowed_replace_with(self):
"""replace_with should fail gracefully"""
filth = Filth()
with self.assertRaises(InvalidReplaceWith):
filth.replace_with('surrogate')
with self.assertRaises(InvalidReplaceWith):
filth.replace_with('something_invalid')
def test_disallowed_replace_with(self):
"""replace_with should fail gracefully"""
filth = Filth()
with self.assertRaises(InvalidReplaceWith):
filth.replace_with('surrogate')
with self.assertRaises(InvalidReplaceWith):
filth.replace_with('something_invalid')
def replace_with(self, replace_with='placeholder', **kwargs):
if replace_with == 'placeholder':
return self.prefix + self.placeholder + self.suffix
# elif replace_with == 'surrogate':
# raise NotImplementedError
elif replace_with == 'identifier':
return self.prefix + self.identifier + self.suffix
else:
raise exceptions.InvalidReplaceWith(replace_with)