コード例 #1
0
 def test_deepcopy(self):
     c1 = Config()
     c1.Foo.bar = 10
     c1.Foo.bam = 30
     c1.a = 'asdf'
     c1.b = range(10)
     c1.Test.logger = logging.Logger('test')
     c1.Test.get_logger = logging.getLogger('test')
     c2 = copy.deepcopy(c1)
     self.assertEqual(c1, c2)
     self.assertTrue(c1 is not c2)
     self.assertTrue(c1.Foo is not c2.Foo)
     self.assertTrue(c1.Test is not c2.Test)
     self.assertTrue(c1.Test.logger is c2.Test.logger)
     self.assertTrue(c1.Test.get_logger is c2.Test.get_logger)
コード例 #2
0
 def test_setget(self):
     c = Config()
     c.a = 10
     self.assertEqual(c.a, 10)
     self.assertEqual('b' in c, False)