def test_get_boundary_locations(): image_height = 11 image_width = 11 num_points_per_edge = 4 locs = _get_boundary_locations(image_height, image_width, num_points_per_edge) num_points = locs.shape[0] assert num_points == (4 + 4 * num_points_per_edge) locs = [(locs[i, 0], locs[i, 1]) for i in range(num_points)] for i in (0, image_height - 1): for j in (0, image_width - 1): assert (i, j) in locs for i in (2, 4, 6, 8): for j in (0, image_width - 1): assert (i, j) in locs for i in (0, image_height - 1): for j in (2, 4, 6, 8): assert (i, j) in locs
def testGetBoundaryLocations(self): image_height = 11 image_width = 11 num_points_per_edge = 4 locs = _get_boundary_locations(image_height, image_width, num_points_per_edge) num_points = locs.shape[0] self.assertEqual(num_points, 4 + 4 * num_points_per_edge) locs = [(locs[i, 0], locs[i, 1]) for i in range(num_points)] for i in (0, image_height - 1): for j in (0, image_width - 1): self.assertIn((i, j), locs, "{},{} not in the locations".format(i, j)) for i in (2, 4, 6, 8): for j in (0, image_width - 1): self.assertIn((i, j), locs, "{},{} not in the locations".format(i, j)) for i in (0, image_height - 1): for j in (2, 4, 6, 8): self.assertIn((i, j), locs, "{},{} not in the locations".format(i, j))