def testCreateReferenceSystemGRGFromArea_10mNoLargeGrids(self): ''' Testing tool will raise error with NO_LARGE_GRIDS option. ''' if Configuration.DEBUG is True: print(".....CreateReferenceSystemGRGFromAreaTestCase.testCreateReferenceSystemGRGFromArea_10mNoLargeGrids") print("Importing toolbox...") arcpy.ImportToolbox(self.toolboxUnderTest) arcpy.env.overwriteOutput = True #inputs grid_size = "10M_GRID" output = os.path.join(self.scratchGDB, "outgrg_10M_fail") #Testing runToolMsg = "Running tool (CreateReferenceSystemGRGFromArea)" arcpy.AddMessage(runToolMsg) Configuration.Logger.info(runToolMsg) with self.assertRaises(arcpy.ExecuteError) as manage_raise: arcpy.CreateReferenceSystemGRGFromArea_grg(self.inputArea10m, self.ref_grid, grid_size, output, "NO_LARGE_GRIDS") self.assertTrue('exceeds large grid value for' in str(manage_raise.exception))
def testCreateReferenceSystemGRGFromArea_GZD(self): ''' Testing with Grid Zone Designator ''' if Configuration.DEBUG is True: print(".....CreateReferenceSystemGRGFromAreaTestCase.testCreateReferenceSystemGRGFromArea_GZD") print("Importing toolbox...") arcpy.ImportToolbox(self.toolboxUnderTest) arcpy.env.overwriteOutput = True #inputs grid_size = "GRID_ZONE_DESIGNATOR" output = os.path.join(self.scratchGDB, "outgrg_GZD") #Testing runToolMsg = "Running tool (CreateReferenceSystemGRGFromArea)" arcpy.AddMessage(runToolMsg) Configuration.Logger.info(runToolMsg) compareDataset = os.path.normpath(os.path.join(Configuration.grgInputGDB, "CompareGZD")) try: arcpy.CreateReferenceSystemGRGFromArea_grg(self.inputArea, self.ref_grid, grid_size, output, self.large_grid_handling) arcpy.AddSpatialIndex_management(output) except arcpy.ExecuteError: UnitTestUtilities.handleArcPyError() except: UnitTestUtilities.handleGeneralError() self.assertFeatureClassEqual(compareDataset, output, arcpy.Describe(output).oidFieldName, None, "ALL", self.ignore_options)