Example #1
0
 def test_invalid_polygon_data(self):
     """
     Passes a point in to the polygon layer.
     :return:
     """
     # Setup
     points = path.join(self.data_directory, "random_data_01.gdb", "points")
     polygons = path.join(self.data_directory, "random_data_01.gdb",
                          "points")
     output = path.join("%ScratchGDB%", get_temp_name())
     # Run with assert exception raised
     with self.assertRaisesRegex(arcgisscripting.ExecuteError,
                                 'Invalid geometry type'):
         arcpy.SimpleTool_simple(points, polygons, output)
Example #2
0
 def test_random_data_01(self):
     """
     A 10x10 grid with 100 random points.
     :return:
     """
     # Setup
     points = path.join(self.data_directory, "random_data_01.gdb", "points")
     polygons = path.join(self.data_directory, "random_data_01.gdb",
                          "polygons")
     answer = path.join(self.data_directory, "random_data_01.gdb", "answer")
     output = path.join("%ScratchGDB%", get_temp_name())
     # Run
     arcpy.SimpleTool_simple(points, polygons, output)
     # assert
     self.assertFeatureClassEqual(answer, output, "OBJECTID")
     # cleanup
     arcpy.Delete_management(output)
Example #3
0
 def test_single_polygon_red(self):
     """
     A single polygon with three red points.
     :return:
     """
     # Setup
     points = path.join(self.data_directory, "single_polygon_red.gdb",
                        "points")
     polygons = path.join(self.data_directory, "single_polygon_red.gdb",
                          "polygons")
     answer = path.join(self.data_directory, "single_polygon_red.gdb",
                        "answer")
     output = path.join("%ScratchGDB%", get_temp_name())
     # Run
     arcpy.SimpleTool_simple(points, polygons, output)
     # assert
     self.assertFeatureClassEqual(answer, output, "OBJECTID")
     # cleanup
     arcpy.Delete_management(output)
Example #4
0
 def test_single_polygon_no_points_by_filter(self):
     """
     A single polygon with no points in the points layer that match either BLUE or RED, but there are ORANGE ones.
     :return:
     """
     # Setup
     points = path.join(self.data_directory,
                        "single_polygon_no_points_by_filter.gdb", "points")
     polygons = path.join(self.data_directory,
                          "single_polygon_no_points_by_filter.gdb",
                          "polygons")
     answer = path.join(self.data_directory,
                        "single_polygon_no_points_by_filter.gdb", "answer")
     output = path.join("%ScratchGDB%", get_temp_name())
     # Run
     arcpy.SimpleTool_simple(points, polygons, output)
     # assert
     self.assertFeatureClassEqual(answer, output, "OBJECTID")
     # cleanup
     arcpy.Delete_management(output)