Пример #1
0
 def test_internal_index_correct_3d(self):
     block_arr = BlockArray(shape=(8, 8, 8))
     assert block_arr.internal_index(0, 0, 0) == 0
     assert block_arr.internal_index(0, 0, 1) == 1
     assert block_arr.internal_index(1, 1, 1) == 73
     assert block_arr.internal_index(7, 3, 3) == 475
     assert block_arr.internal_index(7, 4, 4) == 484
     assert block_arr.internal_index(7, 7, 7) == 8**3 - 1
Пример #2
0
 def test_internal_index_correct_2d(self):
     block_arr = BlockArray(shape=(8, 8), K=2)
     assert block_arr.internal_index(0, 0) == 0
     assert block_arr.internal_index(0, 1) == 1
     assert block_arr.internal_index(1, 1) == 3
     assert block_arr.internal_index(7, 3) == 55
     assert block_arr.internal_index(7, 4) == 58
     assert block_arr.internal_index(7, 7) == 8**2 - 1
Пример #3
0
    def test_internal_index_invalid_arg_3d(self):
        block_arr = BlockArray(shape=(8, 8, 8))
        with pytest.raises(TypeError) as _:
            block_arr.internal_index(1)

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

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