Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

monkeypatch_method.py 383B

12345678910111213141516
  1. # pylint: disable=missing-docstring,too-few-public-methods
  2. '''Test that a function is considered a method when looked up through a class.'''
  3. class Clazz(object):
  4. 'test class'
  5. def __init__(self, value):
  6. self.value = value
  7. def func(arg1, arg2):
  8. 'function that will be used as a method'
  9. return arg1.value + arg2
  10. Clazz.method = func
  11. VAR = Clazz(1).method(2)