示例#1
0
    def test_get_rows_asym_bottom(self):
        """testing making rows unevenly, edge"""

        x_dimension = 5
        y_dimension = 7
        test_array = self.numpy_it(y_dimension, x_dimension)
        increment = 2
        position = y_dimension - (y_dimension % increment)
        base = 0
        step = 1
        self.assertEqual(Tile.get_rows(test_array, position, y_dimension, increment, base, step)[2].tolist(),
                         [[30, 31, 32, 33, 34]])
        self.assertEqual((Tile.get_rows(test_array, position, y_dimension, increment, base, step)[0],
                          Tile.get_rows(test_array, position, y_dimension, increment, base, step)[1]),
                         (6, 7))
示例#2
0
    def test_get_rows_square_bottom(self):
        """testing making rows from square, bottom"""

        y_dimension = 9
        test_array = self.numpy_it(y_dimension, y_dimension)
        increment = 3
        position = y_dimension - increment
        base = 0
        step = 1
        self.assertEqual(Tile.get_rows(test_array, position, y_dimension, increment, base, step)[2].tolist(),
                         [[54, 55, 56, 57, 58, 59, 60, 61, 62],
                          [63, 64, 65, 66, 67, 68, 69, 70, 71],
                          [72, 73, 74, 75, 76, 77, 78, 79, 80]])
        self.assertEqual((Tile.get_rows(test_array, position, y_dimension, increment, base, step)[0],
                          Tile.get_rows(test_array, position, y_dimension, increment, base, step)[1]),
                         (6, 9))
示例#3
0
    def test_get_rows_asym_top(self):
        """testing making rows unevenly, normal"""

        x_dimension = 5
        y_dimension = 7
        test_array = self.numpy_it(y_dimension, x_dimension)
        increment = 2
        position = 0
        base = 0
        step = 1
        self.assertEqual(Tile.get_rows(test_array, position, y_dimension, increment, base, step)[2].tolist(),
                         [[0, 1, 2, 3, 4],
                          [5, 6, 7, 8, 9]])
        self.assertEqual((Tile.get_rows(test_array, position, y_dimension, increment, base, step)[0],
                          Tile.get_rows(test_array, position, y_dimension, increment, base, step)[1]),
                         (0, 2))
示例#4
0
    def test_get_rows_square_top(self):
        """testing making rows from square, top"""

        y_dimension = 9
        test_array = self.numpy_it(y_dimension, y_dimension)
        increment = 3
        position = 0
        base = 0
        step = 1
        self.assertEqual(Tile.get_rows(test_array, position, y_dimension, increment, base, step)[2].tolist(),
                         [[0,  1,  2,  3,  4,  5,  6,  7,  8],
                          [9, 10, 11, 12, 13, 14, 15, 16, 17],
                          [18, 19, 20, 21, 22, 23, 24, 25, 26]])
        self.assertEqual((Tile.get_rows(test_array, position, y_dimension, increment, base, step)[0],
                          Tile.get_rows(test_array, position, y_dimension, increment, base, step)[1]),
                         (0, 3))