# HG changeset patch # User David Barts # Date 1558033460 25200 # Node ID 9d0497dc19f873ffc086efdf48e894814aeab3fc # Parent 6de828de4409aba5036db35b563ef16fbf2abd2e Ack! Think this is the way to introspect. diff -r 6de828de4409 -r 9d0497dc19f8 tincan.py --- a/tincan.py Thu May 16 11:42:56 2019 -0700 +++ b/tincan.py Thu May 16 12:04:20 2019 -0700 @@ -466,10 +466,15 @@ self._class = None for i in dir(mod): v = getattr(mod, i) - if isclass(v) and issubclass(v, klass) and v is not klass: - if self._class is not None and self._class is not klass: - raise TinCanError("{0}: contains multiple {1} classes".format(pypath, klass.__name__)) - self._class = v + if isclass(v) and issubclass(v, klass): + if self._class is None: + self._class = v + else: + if self._class is klass: + self._class = v + elif v is not klass: + raise TinCanError("{0}: contains multiple {1} classes".format( + pypath, klass.__name__)) if self._class is None: raise TinCanError("{0}: contains no {1} classes".format(pypath, klass.__name__))