コード例 #1
0
ファイル: SectionTest.py プロジェクト: andreimacavei/coala
    def test_update_setting(self):
        section = Section("section", None)

        section.append(Setting("key1", "value11"))
        section.append(Setting("key2", "value12"))

        section.update_setting("key1", new_value="value13")
        self.assertEqual("section {key1 : value13, key2 : value12}",
                         section.__str__())
        section.update_setting("key1", "key3")
        self.assertEqual("section {key3 : value13, key2 : value12}",
                         section.__str__())
        section.update_setting("key3", "key4", "value14")
        self.assertEqual("section {key4 : value14, key2 : value12}",
                         section.__str__())
コード例 #2
0
ファイル: SectionTest.py プロジェクト: andreimacavei/coala
    def test_delete_setting(self):
        section = Section("section", None)

        section.append(Setting("key1", "value11"))
        section.append(Setting("key2", "value12"))

        section.delete_setting("key1")
        self.assertEqual("section {key2 : value12}",
                         section.__str__())

        section.append(Setting("key3", "value13"))
        section.append(Setting("key4", "value14"))

        section.delete_setting("key3")
        self.assertEqual("section {key2 : value12, key4 : value14}",
                         section.__str__())