Skip to content

Commit

Permalink
check return
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Dec 4, 2023
1 parent f1fd5da commit 2a9562f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions spinn_utilities/overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,22 @@ def _verify_types(self, method_args, super_args, all_args):
f"Method {self._superclass_method.__name__} "
f"has untyped arguments including {arg}")

if len(all_args) == 0:
if "return" not in super_types and not self._adds_typing:
raise AttributeError(
f"Super Method {self._superclass_method.__name__} "
f"has no arguments so should declare a return type")
if "return" in super_types:
if "return" not in method_types:
raise AttributeError(
f"Method {self._superclass_method.__name__} "
f"has no return type, while super does")
else:
if "return" in method_types:
raise AttributeError(
f"Super Method {self._superclass_method.__name__} "
f"has no return type, while this does")

def __verify_method_arguments(self, method: Method):
"""
Check that the arguments match.
Expand Down

0 comments on commit 2a9562f

Please sign in to comment.