Example #1
0
def test_serialization(es):
    value = ft.IdentityFeature(es["products"].ww["rating"])
    direct = DirectFeature(value, "log")

    log_to_products = next(r for r in es.get_forward_relationships("log")
                           if r.parent_dataframe.ww.name == "products")
    dictionary = {
        "name": direct.get_name(),
        "base_feature": value.unique_name(),
        "relationship": log_to_products.to_dictionary(),
    }

    assert dictionary == direct.get_arguments()
    assert direct == DirectFeature.from_dictionary(
        dictionary, es, {value.unique_name(): value}, PrimitivesDeserializer())
def test_serialization(es):
    value = ft.IdentityFeature(es['products'].ww['rating'])
    direct = DirectFeature(value, 'log')

    log_to_products = next(r for r in es.get_forward_relationships('log')
                           if r.parent_dataframe.ww.name == 'products')
    dictionary = {
        'name': None,
        'base_feature': value.unique_name(),
        'relationship': log_to_products.to_dictionary(),
    }

    assert dictionary == direct.get_arguments()
    assert direct == \
        DirectFeature.from_dictionary(dictionary, es,
                                      {value.unique_name(): value},
                                      PrimitivesDeserializer())