def test_copy(self): b = Board(2, 3) for i in range(b.nrows): for j in range(b.ncols): b[i][j] = (i + 1) * (j + 5) bc = b.copy() self.assertEqual(len(bc), b.nrows) for i in range(len(bc)): self.assertEqual(len(bc[i]), b.ncols) for j in range(len(bc[i])): self.assertEqual(bc[i][j], b[i][j])
from game2dboard import Board b = Board(2, 2) b[0][0] = 5 b[1][1] = 10 print(b) a = b.copy() print(a) b.title = "Hi!" b.grid_color = None b.on_mouse_click = lambda b, r, c: print(type(b), type(r), type(c)) b.show()