当前位置: 首页>>代码示例>>Python>>正文


Python Settings.setSudokuDifficultyLevel方法代码示例

本文整理汇总了Python中Settings.Settings.setSudokuDifficultyLevel方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.setSudokuDifficultyLevel方法的具体用法?Python Settings.setSudokuDifficultyLevel怎么用?Python Settings.setSudokuDifficultyLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Settings.Settings的用法示例。


在下文中一共展示了Settings.setSudokuDifficultyLevel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestSettings

# 需要导入模块: from Settings import Settings [as 别名]
# 或者: from Settings.Settings import setSudokuDifficultyLevel [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()
开发者ID:AlvaroAvila,项目名称:sudokuD,代码行数:101,代码来源:TestSettings.py


注:本文中的Settings.Settings.setSudokuDifficultyLevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。