コード例 #1
0
    def test_case3_grandfather(self):
        config = ConfigParserPlus()
        config.read(os.path.join(fixtures_dir, 'case3', 'father', 'grandfather', 'base.ini'))

        self.assertEquals(config.get('person', 'name'), 'gf')
        self.assertEquals(config.get('person', 'age'), '100')
        self.assertEquals(config.get('person', 'family'), 'Waitman')

        self.assertEquals(config.get('grandfather', 'profession'), 'slave')

        self.assertDoesNotHaveSection(config, 'father')
        self.assertDoesNotHaveSection(config, 'child')
        self.assertDoesNotHaveSection(config, 'foo')
        self.assertDoesNotHaveSection(config, 'entire_block')
コード例 #2
0
    def test_case2_father(self):
        config = ConfigParserPlus()
        config.read(os.path.join(fixtures_dir, 'case2', 'father.ini'))

        self.assertEquals(config.get('person', 'name'), 'f')
        self.assertEquals(config.get('person', 'age'), '50')
        self.assertEquals(config.get('person', 'family'), 'Waitman')

        self.assertEquals(config.get('grandfather', 'profession'), 'slave')

        self.assertEquals(config.get('father', 'profession'), 'woodworker')

        self.assertEquals(config.get('foo', 'only_father'), 'true')

        self.assertEquals(config.get('entire_block', 'x'), 'x')
        self.assertEquals(config.get('entire_block', 'y'), 'y')

        self.assertDoesNotHaveSection(config, 'child')
コード例 #3
0
    def test_case2_child(self):
        config = ConfigParserPlus()
        config.read(os.path.join(fixtures_dir, 'case2', 'child.ini'))

        self.assertEquals(config.get('person', 'name'), 'c')
        self.assertEquals(config.get('person', 'age'), '30')
        self.assertEquals(config.get('person', 'family'), 'Waitman')

        self.assertEquals(config.get('grandfather', 'profession'), 'slave')

        self.assertEquals(config.get('father', 'profession'), 'woodworker')

        self.assertEquals(config.get('child', 'profession'), 'systems analyst')

        self.assertEquals(config.get('entire_block', 'z'), 'z')

        self.assertDoesNotHaveSection(config, 'foo')
コード例 #4
0
    def test_case1(self):
        config = ConfigParserPlus()
        config.read(os.path.join(fixtures_dir, 'case1', 'common.ini'))

        self.assertEquals(config.get('main', 'bla'), 'ble')
        self.assertEquals(config.get('oi', 'x'), 'y')