Example #1
0
 def test_iter_keys_3d(self):
     block_arr = BlockArray(shape=(2, 2, 2))
     assert list(block_arr.iter_keys()) == [(0, 0, 0), (0, 0, 1), (0, 1, 0),
                                            (0, 1, 1), (1, 0, 0), (1, 0, 1),
                                            (1, 1, 0), (1, 1, 1)]
     block_arr = BlockArray(shape=(8, 8, 8))
     assert len(list(block_arr.iter_keys())) == 8**3
Example #2
0
 def test_fill(self):
     block_arr = BlockArray([[False, False], [False, False]])
     for key in block_arr.iter_keys():
         assert not block_arr[key]
     block_arr.fill(True, dtype=bool)
     for key in block_arr.iter_keys():
         assert block_arr[key]
Example #3
0
 def test_iter_keys_2d(self):
     block_arr = BlockArray(shape=(4, 4))
     assert list(block_arr.iter_keys()) == [(0, 0), (0, 1), (0, 2), (0, 3),
                                            (1, 0), (1, 1), (1, 2), (1, 3),
                                            (2, 0), (2, 1), (2, 2), (2, 3),
                                            (3, 0), (3, 1), (3, 2), (3, 3)]
     block_arr = BlockArray(shape=(32, 32))
     assert len(list(block_arr.iter_keys())) == 32**2