def __init__(self, maxcount, config, builtin_icons_path): self._maxcount = maxcount self._config = config self._builtin_icons_path = builtin_icons_path self._recentIconsConfig = StringListSection(self._config, RECENT_ICONS_SECTION, RECENT_ICONS_PARAM_NAME) self._recentIcons = []
def testStringListSection2(self): section = "listSection" paramname = "param_" testlist = ["Бла-бла-бла", "Строка 1", "Строка 2"] self.config.remove_section(section) opt = StringListSection(self.config, section, paramname) self.assertEqual(opt.value, []) # Установим список opt.value = testlist opt_other = StringListSection(self.config, section, paramname) self.assertEqual(len(opt_other.value), 3) self.assertEqual(opt_other.value[0], "Бла-бла-бла") self.assertEqual(opt_other.value[1], "Строка 1") self.assertEqual(opt_other.value[2], "Строка 2") self.config.remove_section(section)
def testStringListSection2(self): section = u"listSection" paramname = u"param_" testlist = [u"Бла-бла-бла", u"Строка 1", u"Строка 2"] self.config.remove_section(section) opt = StringListSection(self.config, section, paramname) self.assertEqual(opt.value, []) # Установим список opt.value = testlist opt_other = StringListSection(self.config, section, paramname) self.assertEqual(len(opt_other.value), 3) self.assertEqual(opt_other.value[0], u"Бла-бла-бла") self.assertEqual(opt_other.value[1], u"Строка 1") self.assertEqual(opt_other.value[2], u"Строка 2") self.config.remove_section(section)
def testStringListSection1(self): section = "listSection" paramname = "param_" testlist = ["Бла-бла-бла", "Строка 1", "Строка 2"] self.config.remove_section(section) opt = StringListSection(self.config, section, paramname) self.assertEqual(opt.value, []) # Установим список opt.value = testlist self.assertEqual(len(opt.value), 3) self.assertEqual(opt.value[0], "Бла-бла-бла") self.assertEqual(opt.value[1], "Строка 1") self.assertEqual(opt.value[2], "Строка 2") self.assertTrue(self.config.has_section(section)) self.assertEqual(self.config.get(section, "param_0"), "Бла-бла-бла") self.assertEqual(self.config.get(section, "param_1"), "Строка 1") self.assertEqual(self.config.get(section, "param_2"), "Строка 2") self.config.remove_section(section)
def testStringListSection1(self): section = u"listSection" paramname = u"param_" testlist = [u"Бла-бла-бла", u"Строка 1", u"Строка 2"] self.config.remove_section(section) opt = StringListSection(self.config, section, paramname) self.assertEqual(opt.value, []) # Установим список opt.value = testlist self.assertEqual(len(opt.value), 3) self.assertEqual(opt.value[0], u"Бла-бла-бла") self.assertEqual(opt.value[1], u"Строка 1") self.assertEqual(opt.value[2], u"Строка 2") self.assertTrue(self.config.has_section(section)) self.assertEqual(self.config.get(section, u"param_0"), u"Бла-бла-бла") self.assertEqual(self.config.get(section, u"param_1"), u"Строка 1") self.assertEqual(self.config.get(section, u"param_2"), u"Строка 2") self.config.remove_section(section)
def __createStringListConfig(self, config): return StringListSection( config, self._tabsSection, self._tabsParamName)