Пример #1
0
def test_slice_four_2d_array():
    gc = GameChecker([1, 2, 3, 4], 2)
    new_array = [[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [2, 2, 2, 2, 2, 2],
                 [3, 3, 3, 3, 3, 3], [4, 4, 4, 4, 4, 4], [5, 5, 5, 5, 5, 5],
                 [6, 6, 6, 6, 6, 6]]
    assert gc.slice_four(new_array) == [[[0, 0, 0, 0, 0,
                                          0], [1, 1, 1, 1, 1, 1],
                                         [2, 2, 2, 2, 2, 2],
                                         [3, 3, 3, 3, 3, 3]],
                                        [[1, 1, 1, 1, 1,
                                          1], [2, 2, 2, 2, 2, 2],
                                         [3, 3, 3, 3, 3, 3],
                                         [4, 4, 4, 4, 4, 4]],
                                        [[2, 2, 2, 2, 2,
                                          2], [3, 3, 3, 3, 3, 3],
                                         [4, 4, 4, 4, 4, 4],
                                         [5, 5, 5, 5, 5, 5]],
                                        [[3, 3, 3, 3, 3,
                                          3], [4, 4, 4, 4, 4, 4],
                                         [5, 5, 5, 5, 5, 5],
                                         [6, 6, 6, 6, 6, 6]]]
Пример #2
0
def test_slice_four_1d_array():
    gc = GameChecker([1, 2, 3, 4], 2)
    new_array = [1, 2, 3, 4, 5, 6]
    assert gc.slice_four(new_array) == [[1, 2, 3, 4], [2, 3, 4, 5],
                                        [3, 4, 5, 6]]