@contextmanager
    def assertImproperlyConfigured(self, message):
        try:
            yield
        except ImproperlyConfigured as err:
            self.assertIn(message, str(err).lower())
        else:
            self.fail('ImproperlyConfigured not raised')
Assert the code in the context manager block raises an error.
dataset/ETHPy150Open frankban/django-endless-pagination/endless_pagination/tests/test_loaders.py/ImproperlyConfiguredTestMixin.assertImproperlyConfigured