本文整理汇总了Python中mythbox.settings.MythSettings.save方法的典型用法代码示例。如果您正苦于以下问题:Python MythSettings.save方法的具体用法?Python MythSettings.save怎么用?Python MythSettings.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mythbox.settings.MythSettings
的用法示例。
在下文中一共展示了MythSettings.save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_saveSettings_LoadedDefaultsCreatesNewSettingsFile
# 需要导入模块: from mythbox.settings import MythSettings [as 别名]
# 或者: from mythbox.settings.MythSettings import save [as 别名]
def test_saveSettings_LoadedDefaultsCreatesNewSettingsFile(self):
filename = "settings.xml"
filepath = os.path.join(self.sandbox, filename)
when(self.platform).getScriptDataDir().thenReturn(self.sandbox)
self.assertFalse(os.path.exists(filepath))
s = MythSettings(self.platform, self.translator)
s.save()
self.assertTrue(os.path.exists(filepath))
示例2: test_When_setting_has_a_unicode_value_Then_saving_and_loading_should_still_work
# 需要导入模块: from mythbox.settings import MythSettings [as 别名]
# 或者: from mythbox.settings.MythSettings import save [as 别名]
def test_When_setting_has_a_unicode_value_Then_saving_and_loading_should_still_work(self):
when(self.platform).getScriptDataDir().thenReturn(self.sandbox)
s = MythSettings(self.platform, self.translator)
unicodeStr = u"Königreich der Himmel"
s.put("recordings_selected_group", unicodeStr)
s.save()
s2 = MythSettings(self.platform, self.translator)
actualStr = s2.get("recordings_selected_group")
self.assertTrue(unicodeStr == actualStr)
self.assertTrue(isinstance(unicodeStr, unicode))