original_docstring: 
      Tests if vector datasources are equal to each other.
  
      This assertion method asserts the equality of these vector
      characteristics:
          + Number of layers in the vector
  
          + Number of features in each layer
  
          + Feature geometry type
  
          + Number of fields in each feature
  
          + Name of each field
  
          + Field values for each feature
  
      Args:
          aUri (string): a URI to an OGR vector
          bUri (string): a URI to an OGR vector
  
      Raises:
          IOError: Raised if one of the input files is not found on disk.
          AssertionError: Raised if the vectors are not found to be equal to\
          one another.
  
      Returns
          Nothing.
      
docstring: Tests if vector datasources are equal to each other.
  This assertion method asserts the equality of these vector
  characteristics:
  + Number of layers in the vector
  
  + Number of features in each layer
  
  + Feature geometry type
  
  + Number of fields in each feature
  
  + Name of each field
  
  + Field values for each feature
  
  aUri (string): a URI to an OGR vector
  bUri (string): a URI to an OGR vector
  
  Raised if one of the input files is not found on disk.
  AssertionError: Raised if the vectors are not found to be equal to\
  one another.
  
  Returns
  Nothing.
docstring_tokens: Tests if vector datasources are equal to each other . This assertion method asserts the equality of these vector characteristics : + Number of layers in the vector + Number of features in each layer + Feature geometry type + Number of fields in each feature + Name of each field + Field values for each feature aUri ( string ) : a URI to an OGR vector bUri ( string ) : a URI to an OGR vector Raised if one of the input files is not found on disk . AssertionError : Raised if the vectors are not found to be equal to \ one another . Returns Nothing .
code: def assert_vectors_equal(aUri, bUri):
      """
      Tests if vector datasources are equal to each other.
  
      This assertion method asserts the equality of these vector
      characteristics:
          + Number of layers in the vector
  
          + Number of features in each layer
  
          + Feature geometry type
  
          + Number of fields in each feature
  
          + Name of each field
  
          + Field values for each feature
  
      Args:
          aUri (string): a URI to an OGR vector
          bUri (string): a URI to an OGR vector
  
      Raises:
          IOError: Raised if one of the input files is not found on disk.
          AssertionError: Raised if the vectors are not found to be equal to\
          one another.
  
      Returns
          Nothing.
      """
  
      for uri in [aUri, bUri]:
          if not os.path.exists(uri):
              raise IOError('File "%s" not found on disk' % uri)
  
      shape = ogr.Open(aUri)
      shape_regression = ogr.Open(bUri)
  
      # Check that the shapefiles have the same number of layers
      layer_count = shape.GetLayerCount()
      layer_count_regression = shape_regression.GetLayerCount()
      assert_equal(layer_count, layer_count_regression,
                          'The shapes DO NOT have the same number of layers')
  
      for layer_num in range(layer_count):
          # Get the current layer
          layer = shape.GetLayer(layer_num)
          layer_regression = shape_regression.GetLayer(layer_num)
          # Check that each layer has the same number of features
          feat_count = layer.GetFeatureCount()
          feat_count_regression = layer_regression.GetFeatureCount()
          assert_equal(feat_count, feat_count_regression,
                              'The layers DO NOT have the same number of features')
  
          assert_equal(layer.GetGeomType(), layer_regression.GetGeomType(),
              'The layers do not have the same geometry type')
  
  
          # Get the first features of the layers and loop through all the features
          feat = layer.GetNextFeature()
          feat_regression = layer_regression.GetNextFeature()
          while feat is not None:
              # Check that the field counts for the features are the same
              layer_def = layer.GetLayerDefn()
              layer_def_regression = layer_regression.GetLayerDefn()
              field_count = layer_def.GetFieldCount()
              field_count_regression = layer_def_regression.GetFieldCount()
              assert_equal(field_count, field_count_regression,
                                  'The shapes DO NOT have the same number of fields')
  
              for fld_index in range(field_count):
                  # Check that the features have the same field values
                  field = feat.GetField(fld_index)
                  field_regression = feat_regression.GetField(fld_index)
                  assert_equal(field, field_regression,
                                          'The field values DO NOT match')
                  # Check that the features have the same field name
                  field_ref = feat.GetFieldDefnRef(fld_index)
                  field_ref_regression = \
                      feat_regression.GetFieldDefnRef(fld_index)
                  field_name = field_ref.GetNameRef()
                  field_name_regression = field_ref_regression.GetNameRef()
                  assert_equal(field_name, field_name_regression,
                                          'The fields DO NOT have the same name')
              # Check that the features have the same geometry
              geom = feat.GetGeometryRef()
              geom_regression = feat_regression.GetGeometryRef()
  
              assert geom.Equals(geom_regression) == True
  
              if layer.GetGeomType() != ogr.wkbPoint:
                  # Check that the features have the same area,
                  # but only if the shapefile's geometry is not a point, since
                  # points don't have area to check.
                  assert_equal(geom.Area(), geom_regression.Area())
  
              feat = None
              feat_regression = None
              feat = layer.GetNextFeature()
              feat_regression = layer_regression.GetNextFeature()
  
      shape = None
      shape_regression = None
code_tokens: def assert_vectors_equal ( aUri , bUri ) : for uri in [ aUri , bUri ] : if not os . path . exists ( uri ) : raise IOError ( 'File "%s" not found on disk' % uri ) shape = ogr . Open ( aUri ) shape_regression = ogr . Open ( bUri ) layer_count = shape . GetLayerCount ( ) layer_count_regression = shape_regression . GetLayerCount ( ) assert_equal ( layer_count , layer_count_regression , 'The shapes DO NOT have the same number of layers' ) for layer_num in range ( layer_count ) : layer = shape . GetLayer ( layer_num ) layer_regression = shape_regression . GetLayer ( layer_num ) feat_count = layer . GetFeatureCount ( ) feat_count_regression = layer_regression . GetFeatureCount ( ) assert_equal ( feat_count , feat_count_regression , 'The layers DO NOT have the same number of features' ) assert_equal ( layer . GetGeomType ( ) , layer_regression . GetGeomType ( ) , 'The layers do not have the same geometry type' ) feat = layer . GetNextFeature ( ) feat_regression = layer_regression . GetNextFeature ( ) while feat is not None : layer_def = layer . GetLayerDefn ( ) layer_def_regression = layer_regression . GetLayerDefn ( ) field_count = layer_def . GetFieldCount ( ) field_count_regression = layer_def_regression . GetFieldCount ( ) assert_equal ( field_count , field_count_regression , 'The shapes DO NOT have the same number of fields' ) for fld_index in range ( field_count ) : field = feat . GetField ( fld_index ) field_regression = feat_regression . GetField ( fld_index ) assert_equal ( field , field_regression , 'The field values DO NOT match' ) field_ref = feat . GetFieldDefnRef ( fld_index ) field_ref_regression = feat_regression . GetFieldDefnRef ( fld_index ) field_name = field_ref . GetNameRef ( ) field_name_regression = field_ref_regression . GetNameRef ( ) assert_equal ( field_name , field_name_regression , 'The fields DO NOT have the same name' ) geom = feat . GetGeometryRef ( ) geom_regression = feat_regression . GetGeometryRef ( ) assert geom . Equals ( geom_regression ) == True if layer . GetGeomType ( ) != ogr . wkbPoint : assert_equal ( geom . Area ( ) , geom_regression . Area ( ) ) feat = None feat_regression = None feat = layer . GetNextFeature ( ) feat_regression = layer_regression . GetNextFeature ( ) shape = None shape_regression = None
short_docstring: Tests if vector datasources are equal to each other.
short_docstring_tokens: Tests if vector datasources are equal to each other .
comment: """
      Tests if vector datasources are equal to each other.
  
      This assertion method asserts the equality of these vector
      characteristics:
          + Number of layers in the vector
  
          + Number of features in each layer
  
          + Feature geometry type
  
          + Number of fields in each feature
  
          + Name of each field
  
          + Field values for each feature
  
      Args:
          aUri (string): a URI to an OGR vector
          bUri (string): a URI to an OGR vector
  
      Raises:
          IOError: Raised if one of the input files is not found on disk.
          AssertionError: Raised if the vectors are not found to be equal to\
          one another.
  
      Returns
          Nothing.
      """$SEP$# Check that the shapefiles have the same number of layers$SEP$# Get the current layer$SEP$# Check that each layer has the same number of features$SEP$# Get the first features of the layers and loop through all the features$SEP$# Check that the field counts for the features are the same$SEP$# Check that the features have the same field values$SEP$# Check that the features have the same field name$SEP$# Check that the features have the same geometry$SEP$# Check that the features have the same area,$SEP$# but only if the shapefile's geometry is not a point, since$SEP$# points don't have area to check.