Esempio n. 1
0
def test_Optimiser_check_lcoe_error(mocker):
    
    # Fake the meta
    meta = mocker.Mock()
    test = Optimiser(meta, "Radial")
    
    # Fake the results
    test.lcoe = [np.inf, np.inf]
    networks = [mocker.Mock(), mocker.Mock()]
    
    for i, network in enumerate(networks):
        
        network.i = i
        network.array_constraints.flag = False
        network.export_constraints.flag = False
        network.lcoe = test.lcoe[i]
    
    test.networks = networks
    
    with pytest.raises(ValueError):
        test.check_lcoe()
Esempio n. 2
0
def test_Optimiser_check_lcoe(mocker):
    
    # Fake the meta
    meta = mocker.Mock()
    test = Optimiser(meta, "Radial")
    
    # Fake the results
    test.lcoe = [2, 1]
    networks = [mocker.Mock(), mocker.Mock()]
    
    for i, network in enumerate(networks):
        
        network.i = i
        network.array_constraints.flag = False
        network.export_constraints.flag = False
        network.lcoe = test.lcoe[i]
    
    test.networks = networks
    
    result = test.check_lcoe()
    
    assert result == 1