Imported Upstream version 1.1.2
[platform/upstream/python-nose.git] / functional_tests / support / att / test_attr.py
1 from nose.plugins.attrib import attr
2 import unittest
3
4 def test_one():
5     pass
6 test_one.a = 1
7 test_one.d = [1, 2]
8
9
10 def test_two():
11     pass
12 test_two.a = 1
13 test_two.c = 20
14 test_two.d = [2, 3]
15
16 def test_three():
17     pass
18 test_three.b = 1
19 test_three.d = [1, 3]
20
21 class TestClass:
22     a = 1
23     def test_class_one(self):
24         pass
25
26     def test_class_two(self):
27         pass
28     test_class_two.b = 2
29
30     def test_class_three(self):
31         pass
32
33     
34 class Something(unittest.TestCase):
35     b = 2
36     def test_case_one(self):
37         pass
38     
39     def test_case_two(self):
40         pass
41     test_case_two.c = 50
42     
43     def test_case_three(self):
44         pass
45
46
47 class Superclass:
48     def test_method(self):
49         pass
50     test_method.from_super = True
51
52 class TestSubclass(Superclass):
53     pass
54
55
56 class Static:
57     def test_with_static(self):
58         pass
59     test_with_static.with_static = True
60
61     def static(self):
62         pass
63     static = staticmethod(static)
64
65
66 class TestClassAndMethodAttrs(unittest.TestCase):
67     def test_method(self):
68         pass
69     test_method.meth_attr = 'method'
70 TestClassAndMethodAttrs.cls_attr = 'class'
71
72
73 class TestAttrClass:
74     from_super = True
75
76     def ends_with_test(self):
77         pass
78
79     def test_one(self):
80         pass
81
82     def test_two(self):
83         pass
84     test_two.from_super = False
85
86 TestAttrClass = attr('a')(TestAttrClass)
87
88
89 class TestAttrSubClass(TestAttrClass):
90     def test_sub_three(self):
91         pass
92
93 def added_later_test(self):
94     pass
95
96 TestAttrSubClass.added_later_test = added_later_test