Exemple #1
0
 def test_iter_keys_3d(self):
     row_arr = RowMajorArray(shape=(2, 2, 2))
     assert list(row_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)]
     row_arr = RowMajorArray(shape=(8, 8, 8))
     assert len(list(row_arr.iter_keys())) == 8**3
Exemple #2
0
 def test_fill(self):
     row_arr = RowMajorArray([[False, False], [False, False]])
     for key in row_arr.iter_keys():
         assert not row_arr[key]
     row_arr.fill(True, dtype=bool)
     for key in row_arr.iter_keys():
         assert row_arr[key]
Exemple #3
0
 def test_iter_keys_2d(self):
     row_arr = RowMajorArray(shape=(4, 4))
     assert list(row_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)]
     row_arr = RowMajorArray(shape=(32, 32))
     assert len(list(row_arr.iter_keys())) == 32**2