Verification of staticmethod and classmethod is currently limited to signature checks. This permits the following code:
Actual
With staticmethod:
class FooInterface(Interface):
@staticmethod
def foo(a, b):
pass
@implements(FooInterface)
class FooImplementation:
def foo(a, b): # missing staticmethod decorator in implementation
pass
With classmethod:
class FooInterface(Interface):
@classmethod
def foo(cls, a, b): # inspect.signature drops first arg, so signature is (a, b)
pass
@implements(FooInterface)
class FooImplementation:
@staticmethod # could be staticmethod, or no decorator (regular method)
def foo(a, b): # signature matches that of classmethod foo(cls, a, b)
pass
Expected
Enhance implements to enforce staticmethod and classmethod on the implementation.
Verification of
staticmethod
andclassmethod
is currently limited to signature checks. This permits the following code:Actual
With
staticmethod
:With
classmethod
:Expected Enhance
implements
to enforcestaticmethod
andclassmethod
on the implementation.