def create_basic_metadata(md):
    """ Used by most above tests to insert a basic set of metadata.
    """

    #--- add schema & struct_types ---
    schema_id = md.schema_tools.setter(schema_name='geoip', 
                                       schema_desc='geoip data')

    #--- add elements ---
    kv = {'schema_id':schema_id,
          'element_name':'cntry_2byte',
          'element_desc':'cntry_2byte_desc',
          'element_type':'string',
          'element_len': 2 }
    md.element_tools.setter(**kv)
    assert md.element_tools.getter(element_name='cntry_2byte').element_len == 2

    #--- add collection ---
    keys = ['schema_id','collection_name','collection_desc']
    v    = [schema_id, 'geolite_country','free maxmind geoip feed']
    kv = dict(zip(keys, v))
    collection_id = md.collection_tools.setter(**kv) 
    assert 0 > collection_id

    #--- add each field ---
    field_keys = ['collection_id', 'field_name','field_desc', 'field_type', 'field_len','element_name']
    val_list = [[collection_id, 'field-a', 'field-a-desc','string',15  , None],
                [collection_id, 'field-b', 'field-b-desc','string',15  , None],
                [collection_id, 'field-c', 'field-c-desc','int'   ,None, None],
                [collection_id, 'field-d', 'field-d-desc','int'   ,None, None],
                [collection_id, 'field-e', 'field-e-desc',None    ,None, 'cntry_2byte'],
                [collection_id, 'field-f', 'field-f-desc','string',40  , None ]]
    for row in val_list:
        kv = dict(zip(field_keys, row))
        assert md.field_tools.setter(**kv) > 0

    return schema_id, collection_id
dataset/ETHPy150Open kenfar/DataGristle/gristle/tests/test_metadata.py/create_basic_metadata/swapped operands of `>`