本文整理汇总了Python中Settings.Settings.restoreDefaultSettings方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.restoreDefaultSettings方法的具体用法?Python Settings.restoreDefaultSettings怎么用?Python Settings.restoreDefaultSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings.Settings
的用法示例。
在下文中一共展示了Settings.restoreDefaultSettings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestSettings
# 需要导入模块: from Settings import Settings [as 别名]
# 或者: from Settings.Settings import restoreDefaultSettings [as 别名]
class TestSettings(unittest.TestCase):
def setUp(self):
self.testSettings = Settings('../Configuration.xml',
"../UserDefaultSettings.xml")
self.testSettings.restoreDefaultSettings()
def testSetdefaultSettings(self):
self.testSettings.restoreDefaultSettings()
self.assertTrue(self.testSettings.areDefaultSettingsSet())
def testGetSudokuDifficultyLevels(self):
listOfLevels = self.testSettings.getSudokuDifficultyLevelOptions()
firstLevel = Level(15, 20, "Easy")
secondLevel = Level(21, 35, "Medium")
thirdLevel = Level(36, 55, "Hard")
levelListComparison = (listOfLevels[0] == firstLevel and
listOfLevels[1] == secondLevel and
listOfLevels[2] == thirdLevel)
self.assertTrue(levelListComparison)
def testGetSudokuGameTypeMethod(self):
expectedResult = "Solve"
self.assertEqual(expectedResult, self.testSettings.getSudokuGameType())
def testGetSudokuDifficultyLevelMethod(self):
testLevel = Level(15, 20,"Easy")
self.assertTrue(self.testSettings.\
getSudokuDifficultyLevel() == testLevel)
def testGetSudokuAlgorithmOptionMethod(self):
expectedResult = "BackTracking"
self.assertEqual(expectedResult, self.testSettings.\
getSudokuAlgorithmOption())
def testGetSudokuOutputFormatMethod(self):
expectedResult = "Console"
self.assertEqual(expectedResult, self.testSettings.\
getSudokuOutputFormat())
def testGetSudokuOutputPathFileMethod(self):
expectedResult = "..\\Sudoku\\"
self.assertEqual(expectedResult, self.testSettings.getSudokuPathFile())
def testGetSudokuFileNameMethod(self):
expectedResult = "SudokuFile.txt"
self.assertEqual(expectedResult, self.testSettings.getSudokuFileName())
def testGetSudokuMatrixDimensionMethod(self):
expectedResult = 9
self.assertEqual(expectedResult, self.testSettings.\
getSudokuMatrixDimension())
def testSetSudokuGameTypeMethod(self):
setTestValueAtGameType = "Generate"
expectedResult = setTestValueAtGameType
self.testSettings.setSudokuGameType(setTestValueAtGameType)
self.assertEqual(expectedResult, self.testSettings.getSudokuGameType())
self.testSettings.restoreDefaultSettings()
def testSetSudokuDifficultyLevelMethod(self):
setTestDifficultyLevel = "Medium"
expectedResult = setTestDifficultyLevel
self.testSettings.setSudokuDifficultyLevel(setTestDifficultyLevel)
self.assertEqual(expectedResult, self.testSettings.\
getSudokuDifficultyLevel())
self.testSettings.restoreDefaultSettings()
def testSetSudokuAlgorithmOptionMethod(self):
setTestAlgorithmOption = "Peter Novig"
expectedResult = setTestAlgorithmOption
self.testSettings.setSudokuAlgorithmOption(setTestAlgorithmOption)
self.assertEqual(expectedResult, self.testSettings.\
getSudokuAlgorithmOption())
self.testSettings.restoreDefaultSettings()
def testSetSudokuOutputFormatMethod(self):
setTestOutputFormat = "Console"
expectedResult = setTestOutputFormat
self.testSettings.setSudokuOutputFormat(setTestOutputFormat)
self.assertEqual(expectedResult, self.testSettings.\
getSudokuOutputFormat())
self.testSettings.restoreDefaultSettings()
def testSetSudokuPathFileMethod(self):
setTestPathFile = "..\\Sudoku\\"
expectedResult = setTestPathFile
self.testSettings.setSudokuPathFile(setTestPathFile)
self.assertEqual(expectedResult, self.testSettings.getSudokuPathFile())
self.testSettings.restoreDefaultSettings()
def testSetSudokuMatrixDimensionMethod(self):
setTestMatrixDimension = 27
expectedResult = setTestMatrixDimension
self.testSettings.setSudokuMatrixDimension(setTestMatrixDimension)
self.assertEqual(expectedResult, self.testSettings.\
getSudokuMatrixDimension())
self.testSettings.restoreDefaultSettings()