From 2a9562f97bb2d7a77066f4b5d7da07e8c9ef5d26 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Mon, 4 Dec 2023 16:07:21 +0000 Subject: [PATCH] check return --- spinn_utilities/overrides.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spinn_utilities/overrides.py b/spinn_utilities/overrides.py index 7ea82fb1..81b02659 100644 --- a/spinn_utilities/overrides.py +++ b/spinn_utilities/overrides.py @@ -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.