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.

unexpected_special_method_signature.py 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. """Test for special methods implemented incorrectly."""
  2. # pylint: disable=missing-docstring, unused-argument, too-few-public-methods
  3. # pylint: disable=invalid-name,too-many-arguments,bad-staticmethod-argument
  4. class Invalid(object):
  5. def __enter__(self, other): # [unexpected-special-method-signature]
  6. pass
  7. def __del__(self, other): # [unexpected-special-method-signature]
  8. pass
  9. def __format__(self, other, other2): # [unexpected-special-method-signature]
  10. pass
  11. def __setattr__(self): # [unexpected-special-method-signature]
  12. pass
  13. def __round__(self, invalid, args): # [unexpected-special-method-signature]
  14. pass
  15. def __deepcopy__(self, memo, other): # [unexpected-special-method-signature]
  16. pass
  17. def __iter__(): # [no-method-argument]
  18. pass
  19. @staticmethod
  20. def __getattr__(self, nanana): # [unexpected-special-method-signature]
  21. pass
  22. class FirstBadContextManager(object):
  23. def __enter__(self):
  24. return self
  25. def __exit__(self, exc_type): # [unexpected-special-method-signature]
  26. pass
  27. class SecondBadContextManager(object):
  28. def __enter__(self):
  29. return self
  30. def __exit__(self, exc_type, value, tb, stack): # [unexpected-special-method-signature]
  31. pass
  32. class ThirdBadContextManager(object):
  33. def __enter__(self):
  34. return self
  35. # +1: [unexpected-special-method-signature]
  36. def __exit__(self, exc_type, value, tb, stack, *args):
  37. pass
  38. class Async(object):
  39. def __aiter__(self, extra): # [unexpected-special-method-signature]
  40. pass
  41. def __anext__(self, extra, argument): # [unexpected-special-method-signature]
  42. pass
  43. def __await__(self, param): # [unexpected-special-method-signature]
  44. pass
  45. def __aenter__(self, first): # [unexpected-special-method-signature]
  46. pass
  47. def __aexit__(self): # [unexpected-special-method-signature]
  48. pass
  49. class Valid(object):
  50. def __new__(cls, test, multiple, args):
  51. pass
  52. def __init__(self, this, can, have, multiple, args, as_well):
  53. pass
  54. def __call__(self, also, trv, for_this):
  55. pass
  56. def __round__(self, n):
  57. pass
  58. def __index__(self, n=42):
  59. """Expects 0 args, but we are taking in account arguments with defaults."""
  60. def __deepcopy__(self, memo):
  61. pass
  62. def __format__(self, format_specification=''):
  63. pass
  64. def __copy__(self, this=None, is_not=None, necessary=None):
  65. pass
  66. @staticmethod
  67. def __enter__():
  68. pass
  69. @staticmethod
  70. def __getitem__(index):
  71. pass
  72. class FirstGoodContextManager(object):
  73. def __enter__(self):
  74. return self
  75. def __exit__(self, exc_type, value, tb):
  76. pass
  77. class SecondGoodContextManager(object):
  78. def __enter__(self):
  79. return self
  80. def __exit__(self, exc_type=None, value=None, tb=None):
  81. pass
  82. class ThirdGoodContextManager(object):
  83. def __enter__(self):
  84. return self
  85. def __exit__(self, exc_type, *args):
  86. pass