def impl_const_blocks_cube(self, shape, dtype, start, increment, const_dims, cmp_cube): dtype = cb.get_dtype(dtype) shape = Shape(shape) file_format = 'raw' filename_format = "const_blocks_{{shape}}_{{dtype}}_{start}_{increment}_{const_dims}.{{format}}".format( start=start, increment=increment, const_dims="+".join(repr(d) for d in const_dims), ) filename = filename_format.format(shape=shape, dtype=dtype, format=file_format) cube = cb.const_blocks_cube(shape=shape, dtype=dtype, start=start, increment=increment, const_dims=const_dims) cube_min = cube.min() cube_max = cube.max() self.assertEqual(cube_min, start) self.assertEqual(cb.not_equals_num(cube, cmp_cube), 0)
def impl_join(self, cubes, result): cube = cb.join(cubes) self.assertEqual(cube.shape, result.shape) self.assertEqual(cb.not_equals_num(cube, result), 0)
def assertCubesAreEqual(self, cube_a, cube_b): if cb.not_equals_num(cube_a, cube_b) != 0: raise AssertionError("cubes {} and {} differ".format( cube_a.shape, cube_b.shape))
def not_equals_num_t2(self): num = cb.not_equals_num(self.l0, self.l1, tolerance=2.0) self.assertEqual(num, self.shape.count() - 3)