Skip to content

Commit

Permalink
Add check that a detector filth is really a Filth subclass
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Bird committed Sep 11, 2020
1 parent d3a3ba8 commit 0fc6055
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scrubadub/scrubbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ def add_detector(self, detector_cls):
raise TypeError((
'"%(detector_cls)s" is not a subclass of Detector'
) % locals())
# TODO: should add tests to make sure filth_cls is actually a proper
# filth_cls
if not issubclass(detector_cls.filth_cls, Filth):
raise TypeError((
'The filth_cls "{}" in the detector "{}" is not a subclass '
'of Filth'
).format(detector_cls.filth_cls, detector_cls))
name = detector_cls.filth_cls.type
if name in self._detectors:
raise KeyError((
Expand Down

0 comments on commit 0fc6055

Please sign in to comment.