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.

func_w0233.py 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # pylint: disable=R0903,W0212,W0403,W0406,no-absolute-import,wrong-import-order
  2. """test for call to __init__ from a non ancestor class
  3. """
  4. from __future__ import print_function
  5. from . import func_w0233
  6. import nonexistant
  7. __revision__ = '$Id: func_w0233.py,v 1.2 2004-09-29 08:35:13 syt Exp $'
  8. class AAAA(object):
  9. """ancestor 1"""
  10. def __init__(self):
  11. print('init', self)
  12. BBBBMixin.__init__(self)
  13. class BBBBMixin(object):
  14. """ancestor 2"""
  15. def __init__(self):
  16. print('init', self)
  17. class CCC(BBBBMixin, func_w0233.AAAA, func_w0233.BBBB, nonexistant.AClass):
  18. """mix different things, some inferable some not"""
  19. def __init__(self):
  20. BBBBMixin.__init__(self)
  21. func_w0233.AAAA.__init__(self)
  22. func_w0233.BBBB.__init__(self)
  23. nonexistant.AClass.__init__(self)
  24. class DDDD(AAAA):
  25. """call superclass constructor in disjunct branches"""
  26. def __init__(self, value):
  27. if value:
  28. AAAA.__init__(self)
  29. else:
  30. AAAA.__init__(self)
  31. class Super(dict):
  32. """ test late binding super() call """
  33. def __init__(self):
  34. base = super()
  35. base.__init__()
  36. class Super2(dict):
  37. """ Using the same idiom as Super, but without calling
  38. the __init__ method.
  39. """
  40. def __init__(self):
  41. base = super()
  42. base.__woohoo__()