本文整理汇总了Python中Board.horizontal_validation方法的典型用法代码示例。如果您正苦于以下问题:Python Board.horizontal_validation方法的具体用法?Python Board.horizontal_validation怎么用?Python Board.horizontal_validation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Board
的用法示例。
在下文中一共展示了Board.horizontal_validation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestValidationFunctions
# 需要导入模块: import Board [as 别名]
# 或者: from Board import horizontal_validation [as 别名]
class TestValidationFunctions(unittest.TestCase):
def setUp(self):
self.board=Board()
#fill the board with values that will
#make for both valid and invalid situations
self.board.setValue(0,0,4)
self.board.setValue(4,0,7)
self.board.setValue(0,1,5)
def test_horizontal1(self):
self.assertTrue(self.board.horizontal_validation(0,6))
def test_horizontal2(self):
self.assertFalse(self.board.horizontal_validation(0,4))
def test_vertical1(self):
self.assertTrue(self.board.vertical_validation(0,9))
def test_vertical2(self):
self.assertFalse(self.board.vertical_validation(0,7))
def test_block1(self):
self.assertTrue(self.board.block_validation(2,2,7))
def test_block2(self):
self.assertFalse(self.board.block_validation(2,2,5))
def test_validation1(self):
self.assertTrue(self.board.validate(2,2,8))
def test_validation2(self):
self.assertFalse(self.board.validate(7,0,7))
示例2: TestValidationFunctions
# 需要导入模块: import Board [as 别名]
# 或者: from Board import horizontal_validation [as 别名]
class TestValidationFunctions(unittest.TestCase):
def setUp(self):
self.board=Board()
#fill the board with values that will
#make for both valid and invalid situations
self.board.setValue(0,0,4)
self.board.setValue(0,1,5)
def test_horizontal1(self):
self.assertTrue(self.board.horizontal_validation(0,6))
def test_horizontal2(self):
self.assertFalse(self.board.horizontal_validation(0,4))