示例#1
0
    def but_it_constructs_a_strand_for_a_2D_cube_when_ca_as_0th(
            self, request, cube_):
        cube_.ndim = 2
        _Strand_ = class_mock(request, "cr.cube.cubepart._Strand")

        strand = CubePartition.factory(cube_, 0, ca_as_0th=True)

        _Strand_.assert_called_once_with(cube_, None, None, True, 0, 0)
        assert strand is _Strand_.return_value
示例#2
0
    def and_it_constructs_a_strand_for_a_1D_cube(self, request, cube_):
        cube_.ndim = 1
        _Strand_ = class_mock(request, "cr.cube.cubepart._Strand")

        strand = CubePartition.factory(cube_, 42, {"trans": "forms"}, 1000,
                                       False, 10)

        _Strand_.assert_called_once_with(cube_, {"trans": "forms"}, 1000,
                                         False, 42, 10)
        assert strand is _Strand_.return_value
示例#3
0
 def partitions(self):
     """Sequence of _Slice, _Strand, or _Nub objects from this cube-result."""
     return tuple(
         CubePartition.factory(
             self,
             slice_idx=slice_idx,
             transforms=self._transforms_dict,
             population=self._population,
             ca_as_0th=self._ca_as_0th,
             mask_size=self._mask_size,
         ) for slice_idx in self._slice_idxs)
示例#4
0
    def it_constructs_a_slice_with_its_factory_for_a_2D_cube(
            self, request, cube_):
        cube_.ndim = 2
        _Slice_ = class_mock(request, "cr.cube.cubepart._Slice")

        slice_ = CubePartition.factory(cube_, 42, {"trans": "forms"}, 1000,
                                       False, 10)

        _Slice_.assert_called_once_with(cube_, 42, {"trans": "forms"}, 1000,
                                        10)
        assert slice_ is _Slice_.return_value