Esempio n. 1
0
 def test_internal_index_correct_3d(self):
     row_arr = RowMajorArray(shape=(8, 8, 8))
     assert row_arr.internal_index(0, 0, 0) == 0
     assert row_arr.internal_index(0, 0, 1) == 1
     assert row_arr.internal_index(1, 1, 1) == 8**2 + 8 + 1
     assert row_arr.internal_index(7, 3, 3) == 7 * 8**2 + 3 * 8 + 3
     assert row_arr.internal_index(7, 4, 4) == 7 * 8**2 + 4 * 8 + 4
     assert row_arr.internal_index(7, 7, 7) == 8**3 - 1
Esempio n. 2
0
    def test_internal_index_invalid_arg_3d(self):
        row_arr = RowMajorArray(shape=(8, 8, 8))
        with pytest.raises(TypeError) as _:
            row_arr.internal_index(1)

        with pytest.raises(TypeError) as _:
            row_arr.internal_index(1, 1)

        with pytest.raises(TypeError) as _:
            row_arr.internal_index(1, 1, 1, 1)