Ejemplo n.º 1
0
def test_initially_unprocessed(data_for_testing):
    """Ensure processind happens at right moment """
    wb = DatabaseWaterBalancer(ecoinvent_version='test_db',
                               database_name="test_db",
                               biosphere="biosphere")
    ab = ActivityWaterBalancer(('test_db', 'A'), wb)
    assert not ab._processed()
    ab._identify_strategy()
    assert not ab._processed()
    ab._define_balancing_parameters()
    assert ab._processed()
Ejemplo n.º 2
0
def test_reset(data_for_testing):
    """Check _reset function"""
    wb = DatabaseWaterBalancer(ecoinvent_version='test_db',
                               database_name="test_db",
                               biosphere="biosphere")
    ab = ActivityWaterBalancer(('test_db', 'A'), wb)
    ab._identify_strategy()
    ab._define_balancing_parameters()
    assert ab._processed()
    ab._reset()
    assert not ab._processed()
    assert getattr(ab, "static_ratio") is None
    assert getattr(ab, "static_balance") is None
    assert getattr(ab, "activity_params") == []
Ejemplo n.º 3
0
def test_rebalance_skip_no_input(data_for_testing):
    wb = DatabaseWaterBalancer(ecoinvent_version='test_db',
                               database_name="test_db",
                               biosphere="biosphere")
    ab = ActivityWaterBalancer(('test_db', 'I'), wb)
    ab._identify_strategy()
    assert ab.strategy == 'skip'
    assert ab._processed()
    assert getattr(ab, "static_ratio", "Nope") is "Nope"
    assert getattr(ab, "static_balance", "Nope") is "Nope"
    assert ab.generate_samples() == []