Ejemplo n.º 1
0
def test_transposed():
    a = MyMatrix([[1, 3, 4], [5, 7, 2]])
    assert (a.transposed().get_data() == [[1, 5], [3, 7], [4, 2]])
    assert (a.get_data() == [[1, 3, 4], [5, 7, 2]])
    a = MyMatrix([[1, 3], [5, 7], [9, 0]])
    assert (a.transposed().get_data() == [[1, 5, 9], [3, 7, 0]])
    assert (a.get_data() == [[1, 3], [5, 7], [9, 0]])
Ejemplo n.º 2
0
def test_flipped_up_down():
    a = MyMatrix([[1, 3, 4], [5, 7, 2]])
    assert (a.flipped_up_down().get_data() == [[5, 7, 2], [1, 3, 4]])
    assert (a.get_data() == [[1, 3, 4], [5, 7, 2]])
Ejemplo n.º 3
0
def test_flipped_left_right():
    a = MyMatrix([[1, 3, 4], [5, 7, 2]])
    assert (a.flipped_left_right().get_data() == [[4, 3, 1], [2, 7, 5]])
    assert (a.get_data() == [[1, 3, 4], [5, 7, 2]])