summaryrefslogtreecommitdiff
path: root/test/input/func_bad_context_manager.py
blob: 620190da3dfb2d46eba2eecdf9a6a79a68be3b7e (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
"""Check that __exit__ special method accepts 3 arguments """

# pylint: disable=too-few-public-methods, invalid-name

__revision__ = 0

class FirstGoodContextManager(object):
    """ 3 arguments """

    def __enter__(self):
        return self

    def __exit__(self, exc_type, value, tb):
        pass

class SecondGoodContextManager(object):
    """ 3 keyword arguments """

    def __enter__(self):
        return self

    def __exit__(self, exc_type=None, value=None, tb=None):
        pass

class ThirdGoodContextManager(object):
    """ 1 argument and variable arguments """

    def __enter__(self):
        return self

    def __exit__(self, exc_type, *args):
        pass

class FirstBadContextManager(object):
    """ 1 argument """

    def __enter__(self):
        return self

    def __exit__(self, exc_type):
        pass

class SecondBadContextManager(object):
    """ Too many arguments """

    def __enter__(self):
        return self

    def __exit__(self, exc_type, value, tb, stack):
        pass