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()
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") == []
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() == []