def test_collidingRenames(self): settings = { setting.name: setting for setting in self.testSettings + [ setting.Setting("someOtherSetting", default=None, oldNames=[("oSetting1", None)]) ] } with self.assertRaises(SettingException): _ = settingsIO.SettingRenamer(settings)
def test_rename(self): renamer = settingsIO.SettingRenamer( {setting.name: setting for setting in self.testSettings}) self.assertEqual(renamer.renameSetting("testSetting1"), ("testSetting1", False)) self.assertEqual(renamer.renameSetting("oSetting1"), ("testSetting1", True)) # this one is expired self.assertEqual(renamer.renameSetting("osetting1"), ("osetting1", False)) self.assertEqual(renamer.renameSetting("oSetting2"), ("testSetting2", True)) self.assertEqual(renamer.renameSetting("testSetting2"), ("testSetting2", False)) self.assertEqual(renamer.renameSetting("testSetting3"), ("testSetting3", False)) # No rename; let it through self.assertEqual(renamer.renameSetting("boo!"), ("boo!", False))