Пример #1
0
def test_flip_up_down():
    m1 = MyMatrix(a)
    m2 = MyMatrix(c)
    m1.flip_up_down()
    m2.flip_up_down()
    assert (m1.get_data() == [[0, 4], [1, 1], [2, 2]])
    assert (m2.get_data() == [])
Пример #2
0
def test_flip_up_down():
    m = [[1, 2, 3], [4, 5, 6]]
    matrix = MyMatrix(m)
    matrix.flip_up_down()
    assert (matrix.size() == (2, 3))
    assert (matrix.get_data() == [[4, 5, 6], [1, 2, 3]])
    empty_matrix = MyMatrix([])
    assert (empty_matrix.get_data() == [])
Пример #3
0
def test_size():
    mymatrix = MyMatrix([[1, 2], [3, 4]])
    mymatrix.flip_up_down()
    mymatrix.flip_left_right()
    assert (mymatrix.size() == (2, 2))
    mymatrix = MyMatrix([[1, 2, 3], [4, 5, 6]])
    assert (mymatrix.size() == (2, 3))
    mymatrix = MyMatrix([[-1, 556], [989, -4]])
    assert (mymatrix.size() == (2, 2))
    mymatrix = MyMatrix([[], []])
    assert (mymatrix.size() == (2, 0))
Пример #4
0
def test_flip_up_down():
    mymatrix = MyMatrix([[1, 2], [3, 4]])
    mymatrix.flip_up_down()
    assert (repr(mymatrix) == '3 4\n1 2')
    assert (mymatrix.size() == (2, 2))
    mymatrix = MyMatrix([[1, 2, 3, 4], [5, 6, 7, 8]])
    mymatrix.flip_up_down()
    assert (repr(mymatrix) == '5 6 7 8\n1 2 3 4')
    assert (mymatrix.size() == (2, 4))
    mymatrix = MyMatrix([[0, 2], [3, 0]])
    mymatrix.flip_up_down()
    assert (repr(mymatrix) == '3 0\n0 2')
    mymatrix = MyMatrix([[0], [0]])
    mymatrix.flip_up_down()
    assert (repr(mymatrix) == '0\n0')
Пример #5
0
def test_flip_up_down():
    zero_matrix = MyMatrix([])
    matrix = MyMatrix([[1, 2], [5, 6], [4, 7]])
    assert (matrix.flip_up_down().get_data() == [[4, 7], [5, 6], [1, 2]])
    assert (zero_matrix.flip_up_down().get_data() == [])
Пример #6
0
def test_flip_up_down():
    some_list = [[4, 5, 6], [1, 2, 3]]
    m = MyMatrix(some_list)
    m.flip_up_down()
    assert (m.get_data() == [[1, 2, 3], [4, 5, 6]])
Пример #7
0
def test_flip_up_down():
    matrix = MyMatrix([[1, 2, 3], [4, 5, 6]])
    assert (matrix.flip_up_down()._get_data() == [[4, 5, 6], [1, 2, 3]])
    assert (repr(matrix) == '4 5 6 \n1 2 3')
    matrix = MyMatrix([[1, 2], [4, 5]])
    assert (matrix.flip_up_down()._get_data() == [[4, 5], [1, 2]])
Пример #8
0
def test_flip_up_down():
    matrix = MyMatrix(a)
    matrix.flip_up_down()
    assert (matrix.get_data() == [[4, 5], [3, 4], [1, 2]])
    empty_matrix = MyMatrix(c)
    assert (empty_matrix.get_data() == [])