示例#1
0
def test_make_str_from_row():
    res_1 = a3.make_str_from_row(BOARD, 0)
    res_2 = a3.make_str_from_row(BOARD, 1)

    assert type(res_1) is str
    assert res_1 == "ANTT"
    assert res_2 == "XSOB"
示例#2
0
def print_board(board):
    ''' (list of str) -> NoneType

    Display the contents of board.
    '''
    
    for row_idx in range(len(board)):
        print(a3.make_str_from_row(board, row_idx))
示例#3
0
def print_board(board):
    """ (list of str) -> NoneType

    Display the contents of board.
    """

    for row_idx in range(len(board)):
        print(a3.make_str_from_row(board, row_idx))
示例#4
0
 def test_make_str_from_row_1(self):
     # given
     board = [['A', 'N', 'T', 'T'], ['X', 'S', 'O', 'B']]
     row_index = 1
     # when
     string = a3.make_str_from_row(board, row_index)
     # then
     self.assertEqual(string, 'XSOB')
示例#5
0
 def test_str_from_row(self):
     self.assertEqual(a3.make_str_from_row(self.board1, 0),'ANTT')
     self.assertEqual(a3.make_str_from_row(self.board2, 1),'CYK')
示例#6
0
import a3

print(a3.is_valid_word(['ANT', 'BOX', 'SOB', 'TO'], 'TO'))
print(a3.is_valid_word(['ANT', 'BOX', 'SOB', 'TO'], 'BOX'))
print(a3.is_valid_word(['ANT', 'BOX', 'SOB', 'TO'], 'TEN'))

print(a3.make_str_from_row([['A', 'N', 'T', 'T'], ['X', 'S', 'O', 'B']], 0))
print(a3.make_str_from_row([['A', 'N', 'T', 'T'], ['X', 'S', 'O', 'B']], 1))

# lst = [['A', 'N', 'T', 'T'], ['X', 'S', 'O', 'B']]

# print(len(lst))

# print(lst)
# print(lst[0][0])
# print(lst[0][1])
# print(lst[0][2])
# print(lst[0][3])

# lst = ['A', 'N', 'T', 'T']
# print(lst[0])

# for i in range(len(lst)):
#   print(lst[i])

lst = [['A', 'N', 'T', 'T'], ['X', 'S', 'O', 'B']]

print(range(len(lst)))
#    print(lst[i][1])

#print(lst[0][1] + lst[1][1])
示例#7
0
 def test_make_str_from_row_2(self):
     self.assertEquals('XSOB', a3.make_str_from_row([['A', 'N', 'T', 'T'], ['X', 'S', 'O', 'B']], 1))
示例#8
0
 def test_make_str_from_row(self):
     self.assertEquals('ANTT', a3.make_str_from_row([['A', 'N', 'T', 'T'], ['X', 'S', 'O', 'B']], 0))
示例#9
0
文件: a3test.py 项目: MEG311/Misc
 def test08_make_str_from_row(self):
     """should return correct word for last row index for square board"""
     self.assertEqual("SASDELTA", a3.make_str_from_row(self.sym_board, 7))
示例#10
0
文件: a3test.py 项目: MEG311/Misc
 def test07_make_str_from_row(self):
     """should return correct word for first row index for non square board"""
     self.assertEqual("BKITEATO", a3.make_str_from_row(self.asym_board, 0))