How to use the scrubadub.exceptions.InvalidReplaceWith function in scrubadub

To help you get started, we’ve selected a few scrubadub examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github datascopeanalytics / scrubadub / tests / test_filth.py View on Github external
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')
github datascopeanalytics / scrubadub / tests / test_filth.py View on Github external
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')
github datascopeanalytics / scrubadub / scrubadub / filth / base.py View on Github external
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)