blob: 1f6ea21e6ca2dd4d6faabfefefbdc6905286c0bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
"""Tests for the mixin-class-rgx option"""
# pylint: disable=too-few-public-methods
# Tests for not-async-context-manager
class AsyncManagerMixedin:
"""Class that does not match the option pattern"""
def __aenter__(self):
pass
class AsyncManagerMixin:
"""Class that does match the option pattern"""
def __aenter__(self):
pass
async def check_not_async_context_manager():
"""Function calling the classes for not-async-context-manager"""
async with AsyncManagerMixedin: # [not-async-context-manager]
pass
async with AsyncManagerMixin():
pass
# Tests for attribute-defined-outside-init
class OutsideInitMixedin:
"""Class that does not match the option pattern"""
def set_attribute(self):
"""Set an attribute outside of __init__"""
self.attr = 1 # [attribute-defined-outside-init]
class OutsideInitMixin:
"""Class that does match the option pattern"""
def set_attribute(self):
"""Set an attribute outside of __init__"""
self.attr = 1
# Tests for no-member
class NoMemberMixedin:
"""Class that does not match the option pattern"""
MY_CLASS = OutsideInitMixedin().method() # [no-member]
class NoMemberMixin:
"""Class that does match the option pattern"""
MY_OTHER_CLASS = NoMemberMixin().method()
|