aboutsummaryrefslogtreecommitdiffstats
path: root/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/trial/test/sample.py
blob: d86441975778d12d13d0f980348c77a820f136ca (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
"""This module is used by test_loader to test the Trial test loading
functionality. Do NOT change the number of tests in this module.  Do NOT change
the names the tests in this module.
"""

import unittest as pyunit
from twisted.trial import unittest
from twisted.python.util import mergeFunctionMetadata



class FooTest(unittest.TestCase):


    def test_foo(self):
        pass


    def test_bar(self):
        pass



def badDecorator(fn):
    """
    Decorate a function without preserving the name of the original function.
    Always return a function with the same name.
    """
    def nameCollision(*args, **kwargs):
        return fn(*args, **kwargs)
    return nameCollision



def goodDecorator(fn):
    """
    Decorate a function and preserve the original name.
    """
    def nameCollision(*args, **kwargs):
        return fn(*args, **kwargs)
    return mergeFunctionMetadata(fn, nameCollision)



class DecorationTest(unittest.TestCase):
    def test_badDecorator(self):
        """
        This test method is decorated in a way that gives it a confusing name
        that collides with another method.
        """
    test_badDecorator = badDecorator(test_badDecorator)


    def test_goodDecorator(self):
        """
        This test method is decorated in a way that preserves its name.
        """
    test_goodDecorator = goodDecorator(test_goodDecorator)


    def renamedDecorator(self):
        """
        This is secretly a test method and will be decorated and then renamed so
        test discovery can find it.
        """
    test_renamedDecorator = goodDecorator(renamedDecorator)


    def nameCollision(self):
        """
        This isn't a test, it's just here to collide with tests.
        """



class PyunitTest(pyunit.TestCase):


    def test_foo(self):
        pass


    def test_bar(self):
        pass



class NotATest(object):


    def test_foo(self):
        pass



class AlphabetTest(unittest.TestCase):


    def test_a(self):
        pass


    def test_b(self):
        pass


    def test_c(self):
        pass