def test_table_to_lineofbearing_desktop(self): '''Test Table To Line Of Bearing for ArcGIS Desktop''' runToolMessage = ".....TableToLineOfBearingTestCase.test_table_to_lineofbearing_desktop" arcpy.ImportToolbox(Configuration.military_DesktopToolboxPath, "mt") arcpy.AddMessage(runToolMessage) Configuration.Logger.info(runToolMessage) arcpy.TableToLineOfBearing_mt(self.inputTable, "DD_2", "x", "y", "DEGREES", "Orientation", "METERS", "Distance", self.outputLineOfBearing, "GEODESIC", None) self.assertTrue(arcpy.Exists(self.outputLineOfBearing), "Output features do not exist or were not created") featureCount = int( arcpy.GetCount_management(self.outputLineOfBearing).getOutput(0)) expectedFeatures = int(23) self.assertEqual( featureCount, expectedFeatures, "Expected %s features, but got %s" % (str(expectedFeatures), str(featureCount))) compareFeatures = arcpy.FeatureCompare_management( self.BaseFC, self.outputLineOfBearing, "OID") # identical = 'true' means that there are no differences between the base and the output feature class identical = compareFeatures.getOutput(1) self.assertEqual(identical, "true", "Feature compare failed: \n %s" % arcpy.GetMessages()) return
def test_table_to_lineofbearing_UTM_BANDS(self): '''Test Table To Line Of Bearing for ArcGIS_UTM_BANDS''' # Delete the output feature class if already exists if arcpy.Exists(self.outputLineOfBearing) : arcpy.Delete_management(self.outputLineOfBearing) Configuration.Logger.info(".....TableToLineOfBearingTestCase.test_table_to_lineofbearing_UTM_BANDS") arcpy.TableToLineOfBearing_mt(self.inputSingleTable, "UTM_BANDS", "UTM", None, "DEGREES", "Orientation", "METERS", "Distance", self.outputLineOfBearing, "GEODESIC", None) self.assertTrue(arcpy.Exists(self.outputLineOfBearing), "Output features do not exist or were not created") featureCount = int(arcpy.GetCount_management(self.outputLineOfBearing).getOutput(0)) expectedFeatures = int(23) self.assertEqual(featureCount, expectedFeatures, "Expected %s features, but got %s" % (str(expectedFeatures), str(featureCount))) # TODO: Needs correct known good results featureclass # self.assertFeatureClassEqual(self.baseFC, self.outputLineOfBearing, \ # "OBJECTID") return
def test_table_to_lineofbearing(self): '''Test Table To Line Of Bearing for ArcGIS''' # Delete the output feature class if already exists if arcpy.Exists(self.outputLineOfBearing) : arcpy.Delete_management(self.outputLineOfBearing) Configuration.Logger.info(".....TableToLineOfBearingTestCase.test_table_to_lineofbearing") arcpy.TableToLineOfBearing_mt(self.inputTable, "DD_2", "x", "y", "DEGREES", "Orientation", \ "METERS", "Distance", self.outputLineOfBearing, "GEODESIC", None) self.assertTrue(arcpy.Exists(self.outputLineOfBearing), "Output features do not exist or were not created") featureCount = int(arcpy.GetCount_management(self.outputLineOfBearing).getOutput(0)) expectedFeatures = int(23) self.assertEqual(featureCount, expectedFeatures, "Expected %s features, but got %s" % (str(expectedFeatures), str(featureCount))) # Set tolerances for compare attribute_tolerances = 'Shape_Length 0.0001;DDLat 0.00001;DDLon 0.00001' xy_tolerance = 0.0001 self.assertFeatureClassEqualSimple(self.baseFC, self.outputLineOfBearing, \ "OID", xy_tolerance, attribute_tolerances) return