Exemplo n.º 1
0
def test_to_pickle_id_none():
    path = os.path.join(CACHE, 'es')
    os.makedirs(path)
    es = EntitySet()
    es.to_pickle(path)
    new_es = deserialize.read_entityset(path)
    assert es.__eq__(new_es, deep=True)
    shutil.rmtree(path)
Exemplo n.º 2
0
def test_all_ww_logical_types():
    logical_types = list_logical_types()['type_string'].to_list()
    dataframe = pd.DataFrame(columns=logical_types)
    es = EntitySet()
    ltype_dict = {ltype: ltype for ltype in logical_types}
    ltype_dict['ordinal'] = Ordinal(order=[])
    es.add_dataframe(dataframe=dataframe,
                     dataframe_name='all_types',
                     index='integer',
                     logical_types=ltype_dict)
    description = serialize.entityset_to_description(es)
    _es = deserialize.description_to_entityset(description)
    assert es.__eq__(_es, deep=True)
Exemplo n.º 3
0
def test_with_custom_ww_logical_type():
    class CustomLogicalType(LogicalType):
        pass

    ww_type_system.add_type(CustomLogicalType)
    columns = ['integer', 'natural_language', 'custom_logical_type']
    dataframe = pd.DataFrame(columns=columns)
    es = EntitySet()
    ltype_dict = {
        'integer': 'integer',
        'natural_language': 'natural_language',
        'custom_logical_type': CustomLogicalType,
    }
    es.add_dataframe(dataframe=dataframe,
                     dataframe_name='custom_type',
                     index='integer',
                     logical_types=ltype_dict)
    description = serialize.entityset_to_description(es)
    _es = deserialize.description_to_entityset(description)
    assert isinstance(
        _es['custom_type'].ww.logical_types['custom_logical_type'],
        CustomLogicalType)
    assert es.__eq__(_es, deep=True)
def test_to_pickle_id_none(tmpdir):
    es = EntitySet()
    es.to_pickle(str(tmpdir))
    new_es = deserialize.read_entityset(str(tmpdir))
    assert es.__eq__(new_es, deep=True)
Exemplo n.º 5
0
def test_to_pickle_id_none(path_management):
    es = EntitySet()
    es.to_pickle(path_management)
    new_es = deserialize.read_entityset(path_management)
    assert es.__eq__(new_es, deep=True)