PythonExtra/tests/basics/class_staticclassmethod.py
Damien George 539681fffd tests: Rename test scripts, changing - to _ for consistency.
From now on, all new tests must use underscore.

Addresses issue #727.
2014-07-05 06:14:29 +01:00

26 lines
412 B
Python

# test static and class methods
class C:
@staticmethod
def f(rhs):
print('f', rhs)
@classmethod
def g(self, rhs):
print('g', rhs)
# builtin wrapped in staticmethod
@staticmethod
def __sub__(rhs):
print('sub', rhs)
# builtin wrapped in classmethod
@classmethod
def __add__(self, rhs):
print('add', rhs)
c = C()
c.f(0)
c.g(0)
c - 1
c + 2