Example #1
0
    def test_subsection_contains(self):
        c = Configuration()

        c.set('section1.param1', '123')
        c.set_default('section2.param2', '234')

        self.assertTrue('param1' in c.section('section1'))
        self.assertTrue('param2' in c.section('section2'))
        self.assertFalse('param1' in c.section('section2'))
Example #2
0
    def test_subsection_contains(self):
        c = Configuration()

        c.set('section1.param1', '123')
        c.set_default('section2.param2', '234')

        self.assertTrue('param1' in c.section('section1'))
        self.assertTrue('param2' in c.section('section2'))
        self.assertFalse('param1' in c.section('section2'))
Example #3
0
    def test_subsection_getitem(self):
        c = Configuration()
        c.set(self.fullparam, self.value)

        cs = c.section(self.section)

        self.assertEqual(self.value, cs[self.param])
Example #4
0
    def test_subsection_items(self):
        c = Configuration()
        c.set('%s.param1' % self.section, 'value1')
        c.set_default('%s.param2' % self.section, 'value2')

        self.assertEqual([('param1', 'value1'), ('param2', 'value2')],
                         sorted(c.section(self.section).items()))
Example #5
0
    def test_subsection_keys(self):
        c = Configuration()
        c.set_default('%s.param1' % self.section, '123')
        c.set('%s.param2' % self.section, '456')

        self.assertEqual(['param1', 'param2'],
                         sorted(c.section(self.section).keys()))
Example #6
0
    def test_subsection_getitem(self):
        c = Configuration()
        c.set(self.fullparam, self.value)

        cs = c.section(self.section)

        self.assertEqual(self.value, cs[self.param])
Example #7
0
    def test_subsection_keys(self):
        c = Configuration()
        c.set_default('%s.param1' % self.section, '123')
        c.set('%s.param2' % self.section, '456')

        self.assertEqual(
            ['param1', 'param2'], sorted(c.section(self.section).keys()))
Example #8
0
    def test_subsection_setitem(self):
        c = Configuration()

        cs = c.section(self.section)

        cs[self.param] = self.value

        self.assertEqual(self.value, c.get(self.fullparam))
Example #9
0
    def test_subsection_setitem(self):
        c = Configuration()

        cs = c.section(self.section)

        cs[self.param] = self.value

        self.assertEqual(self.value, c.get(self.fullparam))
Example #10
0
    def test_subsection_items(self):
        c = Configuration()
        c.set('%s.param1' % self.section, 'value1')
        c.set_default('%s.param2' % self.section, 'value2')

        self.assertEqual(
            [('param1', 'value1'), ('param2', 'value2')],
            sorted(c.section(self.section).items()))
Example #11
0
    def test_subsection_set(self):
        c = Configuration()
        c.section(self.section).set(self.param, self.value)

        self.assertEqual(self.value, c.get(self.fullparam))
Example #12
0
 def test_returns_section_object_even_if_section_doesnot_exist(self):
     c = Configuration()
     self.assertIsNotNone(c.section('foo'))
Example #13
0
    def test_subsection_set(self):
        c = Configuration()
        c.section(self.section).set(self.param, self.value)

        self.assertEqual(self.value, c.get(self.fullparam))
Example #14
0
 def test_returns_section_object_even_if_section_doesnot_exist(self):
     c = Configuration()
     self.assertIsNotNone(c.section('foo'))