Ejemplo n.º 1
0
def test_set_lognormal_loc_value_on_import():
    import numpy as np
    Migration("default-units").write(get_default_units_migration_data(),
                                     "Convert to default units")
    sp = SimaProCSVImporter(os.path.join(SP_FIXTURES_DIR, "inventory.csv"),
                            normalize_biosphere=False)
    sp.apply_strategies()
    amount = list(sp)[0].get("exchanges")[1]["amount"]
    loc = list(sp)[0].get("exchanges")[1]["loc"]
    assert np.abs(loc - np.log(amount)) < 1E-10
Ejemplo n.º 2
0
def test_sp_import_allocation():
    Migration("default-units").write(get_default_units_migration_data(),
                                     "Convert to default units")

    sp = SimaProCSVImporter(os.path.join(SP_FIXTURES_DIR, "allocation.csv"),
                            normalize_biosphere=False)
    sp.apply_strategies()
    assert sp.statistics() == (3, 5, 0)
    sp.write_database()
Ejemplo n.º 3
0
def test_sp_wrong_field_ordering():
    sp = SimaProCSVImporter(os.path.join(SP_FIXTURES_DIR, "new-order.csv"))
    assert len(sp.data)
    for exc in sp.data[0]['exchanges']:
        assert isinstance(exc['amount'], Number)