Show More
@@ -234,10 +234,18 b' class Component(HasTraitlets):' | |||||
234 | self.root = self # This is the default, it is set when parent is set |
|
234 | self.root = self # This is the default, it is set when parent is set | |
235 | self.parent = parent |
|
235 | self.parent = parent | |
236 | if config is not None: |
|
236 | if config is not None: | |
237 |
self.config = |
|
237 | self.config = config | |
|
238 | # We used to deepcopy, but for now we are trying to just save | |||
|
239 | # by reference. This *could* have side effects as all components | |||
|
240 | # will share config. | |||
|
241 | # self.config = deepcopy(config) | |||
238 | else: |
|
242 | else: | |
239 | if self.parent is not None: |
|
243 | if self.parent is not None: | |
240 |
self.config = |
|
244 | self.config = self.parent.config | |
|
245 | # We used to deepcopy, but for now we are trying to just save | |||
|
246 | # by reference. This *could* have side effects as all components | |||
|
247 | # will share config. | |||
|
248 | # self.config = deepcopy(self.parent.config) | |||
241 |
|
249 | |||
242 | self.created = datetime.datetime.now() |
|
250 | self.created = datetime.datetime.now() | |
243 |
|
251 |
@@ -147,12 +147,12 b' class TestComponentConfig(TestCase):' | |||||
147 | self.assertEquals(c1.config, config) |
|
147 | self.assertEquals(c1.config, config) | |
148 | self.assertEquals(c2.config, config) |
|
148 | self.assertEquals(c2.config, config) | |
149 | self.assertEquals(c3.config, config) |
|
149 | self.assertEquals(c3.config, config) | |
150 |
# Test that |
|
150 | # Test that copies are not made | |
151 |
self.assert_(c1.config is |
|
151 | self.assert_(c1.config is config) | |
152 |
self.assert_(c2.config is |
|
152 | self.assert_(c2.config is config) | |
153 |
self.assert_(c3.config is |
|
153 | self.assert_(c3.config is config) | |
154 |
self.assert_(c1.config is |
|
154 | self.assert_(c1.config is c2.config) | |
155 |
self.assert_(c2.config is |
|
155 | self.assert_(c2.config is c3.config) | |
156 |
|
156 | |||
157 | def test_inheritance(self): |
|
157 | def test_inheritance(self): | |
158 | class MyComponent(Component): |
|
158 | class MyComponent(Component): |
General Comments 0
You need to be logged in to leave comments.
Login now