@@ 116-130 (lines=15) @@ | ||
113 | assert len(scope.dicts) == length |
|
114 | ||
115 | ||
116 | def test_redundant_resume(namespaces): |
|
117 | class Test(namespaces.Namespaceable): |
|
118 | foo = 1 |
|
119 | with namespaces.Namespace() as ns: |
|
120 | foo = 2 |
|
121 | assert foo == 2 |
|
122 | scope_dicts_length_equals(ns, 1) |
|
123 | foo = 3 |
|
124 | ns = ns |
|
125 | scope_dicts_length_equals(ns, 1) |
|
126 | with ns as ns: |
|
127 | foo = 4 |
|
128 | assert foo == 3 |
|
129 | assert Test().foo == 3 |
|
130 | assert Test().ns.foo == 4 |
|
131 | ||
132 | ||
133 | def test_basic_inherit(namespaces): |
|
@@ 92-103 (lines=12) @@ | ||
89 | assert Test().ns.foo == 2 |
|
90 | ||
91 | ||
92 | def test_resume(namespaces): |
|
93 | class Test(namespaces.Namespaceable): |
|
94 | foo = 1 |
|
95 | with namespaces.Namespace() as ns: |
|
96 | foo = 2 |
|
97 | assert foo == 2 |
|
98 | foo = 3 |
|
99 | with ns: |
|
100 | foo = 4 |
|
101 | assert foo == 3 |
|
102 | assert Test().foo == 3 |
|
103 | assert Test().ns.foo == 4 |
|
104 | ||
105 | ||
106 | def get_ns(ns): |