Passed
Pull Request — dev (#789)
by Uwe
03:10 queued 10s
created

flow_tests.test_error_in_gradient_attribute()   A

Complexity

Conditions 3

Size

Total Lines 6
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 3
nop 0
1
# -*- coding: utf-8 -
2
3
"""Testing the flows.
4
5
This file is part of project oemof (github.com/oemof/oemof). It's copyrighted
6
by the contributors recorded in the version control history of the file,
7
available from its original location oemof/tests/test_components.py
8
9
SPDX-License-Identifier: MIT
10
"""
11
12
import warnings
13
14
import pytest
15
from oemof.tools.debugging import SuspiciousUsageWarning
16
17
from oemof.solph import Flow
18
19
20
def test_error_in_gradient_attribute():
21
    msg = "Only the key 'ub' is allowed for the '{0}' attribute"
22
    with pytest.raises(AttributeError, match=msg.format("negative_gradient")):
23
        Flow(negative_gradient={"costs": 5})
24
    with pytest.raises(AttributeError, match=msg.format("positive_gradient")):
25
        Flow(positive_gradient={"something": 5})
26