コード例 #1
0
    def test_section_set_raise(self, sec1, sec2):
        """ OptionModel:section:set change section should raise """

        p = OptionModel('KEY', sec1, 0, int)

        with self.assertRaisesRegexp(ValueError, r'already set'):
            p.section = sec2
コード例 #2
0
    def test_section_set(self, sec1, sec2):
        """ OptionModel:section:set change case of value should work """

        p = OptionModel('KEY', sec1, 0, int)

        p.section = sec2
        self.assertEqual(p.section, sec2)
コード例 #3
0
    def test_section_set_none_to_any(self, new_sec_name):
        """ OptionModel:section:set set value from None to any """

        section_name = None
        p = OptionModel('KEY', section_name, 0, int)

        p.section = new_sec_name

        self.assertEqual(p.section, new_sec_name)