Ejemplo n.º 1
0
 def test_merge_doesnt_exist(self):
     c1 = Config()
     c2 = Config()
     c2.bar = 10
     c2.Foo.bar = 10
     c1.merge(c2)
     self.assertEqual(c1.Foo.bar, 10)
     self.assertEqual(c1.bar, 10)
     c2.Bar.bar = 10
     c1.merge(c2)
     self.assertEqual(c1.Bar.bar, 10)
Ejemplo n.º 2
0
 def test_merge_doesnt_exist(self):
     c1 = Config()
     c2 = Config()
     c2.bar = 10
     c2.Foo.bar = 10
     c1.merge(c2)
     self.assertEqual(c1.Foo.bar, 10)
     self.assertEqual(c1.bar, 10)
     c2.Bar.bar = 10
     c1.merge(c2)
     self.assertEqual(c1.Bar.bar, 10)
Ejemplo n.º 3
0
 def test_custom(self):
     config = Config()
     config.foo = 'foo'
     config.bar = 'bar'
     c1 = Configurable(config=config)
     c2 = Configurable(config=c1.config)
     c3 = Configurable(config=c2.config)
     self.assertEqual(c1.config, config)
     self.assertEqual(c2.config, config)
     self.assertEqual(c3.config, config)
     # Test that copies are not made
     self.assertTrue(c1.config is config)
     self.assertTrue(c2.config is config)
     self.assertTrue(c3.config is config)
     self.assertTrue(c1.config is c2.config)
     self.assertTrue(c2.config is c3.config)
Ejemplo n.º 4
0
 def test_custom(self):
     config = Config()
     config.foo = 'foo'
     config.bar = 'bar'
     c1 = Configurable(config=config)
     c2 = Configurable(config=c1.config)
     c3 = Configurable(config=c2.config)
     self.assertEqual(c1.config, config)
     self.assertEqual(c2.config, config)
     self.assertEqual(c3.config, config)
     # Test that copies are not made
     self.assertTrue(c1.config is config)
     self.assertTrue(c2.config is config)
     self.assertTrue(c3.config is config)
     self.assertTrue(c1.config is c2.config)
     self.assertTrue(c2.config is c3.config)