def test_get_sub_region_y_z_block_far_side(self): """Far side non-cuboid aligned along x axis.""" resolution = 0 corner = (512, 1024, 18) extent = (1026, 514, 16) expected = Region.Bounds( corner=(1536, corner[1], corner[2]), extent=(2, extent[1], extent[2]) ) actual = Region.get_sub_region_y_z_block_far_side(resolution, corner, extent) self.assertEqual(expected, actual)
def test_get_sub_region_y_z_block_near_side_less_than_cuboid2(self): """Cuboid aligned on near side but extents less than a cuboid.""" resolution = 0 corner = (512, 1024, 16) extent = (200, 512, 10) expected = Region.Bounds( corner=corner, extent=extent ) actual = Region.get_sub_region_y_z_block_near_side(resolution, corner, extent) self.assertEqual(expected, actual)
def test_get_sub_region_y_z_block_far_side_none(self): """Far side cuboid aligned along x axis, so x extent is 0.""" resolution = 0 corner = (512, 1023, 16) extent = (1024, 513, 20) expected = Region.Bounds( corner=(1536, corner[1], corner[2]), extent=(0, extent[1], extent[2]) ) actual = Region.get_sub_region_y_z_block_far_side(resolution, corner, extent) self.assertEqual(expected, actual)
def test_get_sub_region_y_z_block_near_side(self): """Near side non-cuboid aligned along x axis.""" resolution = 0 corner = (509, 1024, 14) extent = (1027, 512, 16) expected = Region.Bounds( corner=corner, extent=(3, 512, 16) ) actual = Region.get_sub_region_y_z_block_near_side(resolution, corner, extent) self.assertEqual(expected, actual)
def test_get_sub_region_y_z_block_near_side_less_than_cuboid(self): """Near side non-cuboid aligned along x axis - extents less than a cuboid.""" resolution = 0 corner = (400, 1024, 4) extent = (80, 512, 10) expected = Region.Bounds( corner=corner, extent=extent ) actual = Region.get_sub_region_y_z_block_near_side(resolution, corner, extent) self.assertEqual(expected, actual)
def test_get_sub_region_x_z_block_near_side_none(self): """Near side cuboid aligned along y axis, so y extent is 0.""" resolution = 0 corner = (512, 1024, 16) extent = (1024, 512, 16) expected = Region.Bounds( corner=corner, extent=(1024, 0, 16) ) actual = Region.get_sub_region_x_z_block_near_side(resolution, corner, extent) self.assertEqual(expected, actual)
def test_get_sub_region_x_y_block_far_side(self): """Far side non-cuboid aligned along z axis.""" resolution = 0 corner = (512, 1024, 18) extent = (1024, 512, 15) expected = Region.Bounds( corner=(corner[0], corner[1], 32), extent=(1024, 512, 1) ) actual = Region.get_sub_region_x_y_block_far_side(resolution, corner, extent) self.assertEqual(expected, actual)
def test_get_sub_region_y_z_block_near_side_small_extents(self): """ Near side non-cuboid aligned along x axis and extents less than a cuboid, but a cuboid boundary is crossed. """ resolution = 0 corner = (509, 1024, 14) extent = (100, 512, 16) expected = Region.Bounds( corner=corner, extent=extent ) actual = Region.get_sub_region_y_z_block_near_side(resolution, corner, extent) self.assertEqual(expected, actual)
def test_get_sub_region_x_z_block_near_side_less_than_cuboid2(self): """ Near side non-cuboid aligned along y axis - extents less than a cuboid. This is the same as test_get_sub_region_x_z_block_far_side_less_than_cuboid(), but for the near side calculation, there should be non-zero extents. """ resolution = 0 corner = (512, 1024, 17) extent = (1024, 12, 50) expected = Region.Bounds( corner=corner, extent=extent ) actual = Region.get_sub_region_x_z_block_near_side(resolution, corner, extent) self.assertEqual(expected, actual)
def test_get_sub_region_x_y_block_far_side_less_than_cuboid(self): """ Far side non-cuboid aligned along z axis - extents less than a cuboid. Expect a 0 width slice in the z dimension. This case should be covered by Region.get_sub_region_x_y_block_near_side(). """ resolution = 0 corner = (512, 1024, 17) extent = (1024, 512, 10) expected = Region.Bounds( corner=(corner[0], corner[1], 16), extent=(1024, 512, 0) ) actual = Region.get_sub_region_x_y_block_far_side(resolution, corner, extent) self.assertEqual(expected, actual)