def test_flipped_up_down():
    m1 = MyMatrix(a)
    m2 = MyMatrix(c)
    res1 = m1.flipped_up_down()
    res2 = m2.flipped_up_down()
    assert (res1.get_data() == [[0, 4], [1, 1], [2, 2]])
    assert (res2.get_data() == [])
    assert (m1.get_data() == [[2, 2], [1, 1], [0, 4]])
def test_flipped_up_down():
    zero_matrix = MyMatrix([])
    zero_matrixcopy = zero_matrix.flipped_up_down()
    matrix = MyMatrix([[1, 2], [5, 6], [4, 7]])
    matrix2 = matrix.flipped_up_down()
    assert (matrix2.get_data() == [[4, 7], [5, 6], [1, 2]])
    assert (matrix.get_data() == [[1, 2], [5, 6], [4, 7]])
    assert (zero_matrix.get_data() == [])
    assert (zero_matrixcopy.get_data() == [])
Esempio n. 3
0
def test_flipped_up_down():
    matrix = MyMatrix([[1, 2, 3], [4, 5, 6]])
    new_matrix = matrix.flipped_up_down()
    assert (matrix.get_data() == [[1, 2, 3], [4, 5, 6]])
    assert (matrix.size() == (2, 3))
    assert (new_matrix.get_data() == [[4, 5, 6], [1, 2, 3]])
    empty_matrix = MyMatrix([])
    e = empty_matrix.flipped_up_down()
    assert (empty_matrix.get_data() == [])
    assert (empty_matrix.size() == (0, 0))
    assert (e.get_data() == [])
Esempio n. 4
0
def test_flipped_up_down():
    matrix = MyMatrix(a)
    flmatrix = matrix.flipped_up_down()
    assert (flmatrix.get_data() == [[4, 5], [3, 4], [1, 2]])
    assert (matrix.get_data() == [[1, 2], [3, 4], [4, 5]])
    empty_matrix = MyMatrix(c)
    em_matrix = empty_matrix.flipped_left_right()
    assert (empty_matrix.get_data() == [])
    assert (em_matrix.get_data() == [])
Esempio n. 5
0
def test_flipped_up_down():
    some_list = [[4, 5, 6], [1, 2, 3]]
    m1 = MyMatrix(some_list)
    m2 = m1.flipped_up_down()
    assert (m2.get_data() == [[1, 2, 3], [4, 5, 6]])
    assert (m1.get_data() == [[4, 5, 6], [1, 2, 3]])

    empty_matrix = MyMatrix([])
    empty_matrix.flip_left_right()
    assert (empty_matrix.size() == (0, 0))
    assert (empty_matrix.get_data() == [])
Esempio n. 6
0
def test_flipped_up_down():
    mymatrix = MyMatrix([[1, 2], [3, 4]])
    mymatrix.flipped_up_down()
    assert (mymatrix.flipped_up_down() == [[3, 4], [1, 2]])
    mymatrix = MyMatrix([[1, 2, 3, 4], [5, 6, 7, 8]])
    mymatrix.flipped_up_down()
    assert (mymatrix.flipped_up_down() == [[5, 6, 7, 8], [1, 2, 3, 4]])
    mymatrix = MyMatrix([[0, 2], [3, 0]])
    mymatrix.flipped_up_down()
    assert (mymatrix.flipped_up_down() == [[3, 0], [0, 2]])
    mymatrix = MyMatrix([[0], [0]])
    mymatrix.flipped_up_down()
    assert (mymatrix.flipped_up_down() == [[0], [0]])
    mymatrix = MyMatrix([[0], [0]])
    mymatrix.flipped_up_down()
    assert (mymatrix.flipped_up_down() == [[0], [0]])
Esempio n. 7
0
def test_flipped_up_down():
    matrix = MyMatrix([[1, 2, 3], [4, 5, 6]])
    assert (matrix.flipped_up_down()._get_data() == [[4, 5, 6], [1, 2, 3]])
    assert (repr(matrix) == '1 2 3 \n4 5 6')
    matrix = MyMatrix([[1, 2], [4, 5]])
    assert (matrix.flipped_up_down()._get_data() == [[4, 5], [1, 2]])