示例#1
0
def test_check_activity_link_validity_multiple():
    missing = [{
        'id':
        1,
        'filepath':
        'somewhere',
        'exchanges': [{
            'type': 'reference product',
            'production volume': {
                'amount': 42
            },
            'name': 'widget',
        }, {
            'type': 'reference product',
            'production volume': {
                'amount': 24
            },
            'name': 'widget',
        }]
    }, {
        'id':
        2,
        'exchanges': [{
            'type': 'from technosphere',
            'activity link': 1,
            'name': 'widget',
        }]
    }]
    with pytest.raises(UnresolvableActivityLink):
        check_activity_link_validity(missing)
示例#2
0
def test_check_activity_link_validity_technosphere_exchange():
    missing = [{
        'id': 1,
        'filepath': 'somewhere',
        'exchanges': [{
            'type': 'from technosphere',
            'name': 'widget',
        }]
    }, {
        'id':
        2,
        'exchanges': [{
            'type': 'from technosphere',
            'activity link': 1,
            'name': 'widget',
        }]
    }]
    with pytest.raises(UnresolvableActivityLink):
        check_activity_link_validity(missing)
示例#3
0
def test_check_activity_link_validity_ref_product():
    ref_prod = [{
        'id':
        1,
        'exchanges': [{
            'type': 'reference product',
            'name': 'widget',
            'production volume': {
                'amount': 42
            }
        }]
    }, {
        'id':
        2,
        'exchanges': [{
            'type': 'from technosphere',
            'activity link': 1,
            'name': 'widget',
        }]
    }]
    assert check_activity_link_validity(ref_prod)
示例#4
0
def test_check_activity_link_validity_byproduct():
    byproduct = [{
        'id':
        1,
        'exchanges': [{
            'type': 'byproduct',
            'byproduct classification': 'allocatable product',
            'name': 'widget',
            'production volume': {
                'amount': 42
            }
        }]
    }, {
        'id':
        2,
        'exchanges': [{
            'type': 'from technosphere',
            'activity link': 1,
            'name': 'widget',
        }]
    }]
    assert check_activity_link_validity(byproduct)