Example #1
0
def test_pos_transform():
    pos_pairs = [((0, 0), "A1", 0x00), ((7, 0), "H1", 0x70),
                 ((0, 7), "A8", 0x07), ((7, 7), "H8", 0x77),
                 ((3, 4), "D5", 0x34)]

    for tupl, sp, ip in pos_pairs:
        ok(to_tuple_pos(sp)) == tupl
        ok(to_tuple_pos(ip)) == tupl

        ok(to_str_pos(tupl)) == sp
        ok(to_str_pos(ip)) == sp

        ok(to_int_pos(sp)) == ip
        ok(to_int_pos(tupl)) == ip

    for x in range(8):
        for y in range(8):
            ok(to_tuple_pos(to_str_pos((x, y)))) == (x, y)
            ok(to_tuple_pos(to_int_pos((x, y)))) == (x, y)
Example #2
0
def test_pos_transform():
    pos_pairs = [
        ((0, 0), "A1", 0x00),
        ((7, 0), "H1", 0x70),
        ((0, 7), "A8", 0x07),
        ((7, 7), "H8", 0x77),
        ((3, 4), "D5", 0x34),
    ]

    for tupl, sp, ip in pos_pairs:
        ok(to_tuple_pos(sp)) == tupl
        ok(to_tuple_pos(ip)) == tupl

        ok(to_str_pos(tupl)) == sp
        ok(to_str_pos(ip)) == sp

        ok(to_int_pos(sp)) == ip
        ok(to_int_pos(tupl)) == ip

    for x in range(8):
        for y in range(8):
            ok(to_tuple_pos(to_str_pos((x, y)))) == (x, y)
            ok(to_tuple_pos(to_int_pos((x, y)))) == (x, y)
Example #3
0
 def cell_to_coords(self, cell):
     return self.cell_index_to_coords(*to_tuple_pos(cell))
Example #4
0
 def cell_to_coords(self, cell):
     return self.cell_index_to_coords(*to_tuple_pos(cell))
Example #5
0
 def pos(self):
     return to_tuple_pos(self.ipos)
Example #6
0
 def pos(self):
     return to_tuple_pos(self.ipos)