コード例 #1
0
ファイル: error_tests.py プロジェクト: FranziPl/tespy
 def setup(self):
     self.nw = network(['water', 'air'])
     self.comp = combustion.combustion_engine('combustion engine')
     self.pipe = piping.pipe('pipe')
     self.conn = connection(self.comp, 'out1', self.pipe, 'in1')
     self.bus = bus('mybus')
     self.sub = subsystems.subsystem('MySub')
コード例 #2
0
def test_get_attr_errors():
    """Test errors of get_attr methods."""
    nw = network(['water', 'air'])
    comb = combustion.combustion_engine('combustion engine')
    pipeline = piping.pipe('pipeline')
    conn = connection(comb, 'out1', pipeline, 'in1')
    mybus = bus('mybus')
    sub = subsystems.subsystem('MySub')

    get_attr_KeyError(comb, 'wow')
    get_attr_KeyError(conn, 'key')
    get_attr_KeyError(mybus, 'components')
    get_attr_KeyError(nw, 'missing')
    get_attr_KeyError(ref(conn, 1, 0), 'comp')
    get_attr_KeyError(sub, 'test')
    get_attr_KeyError(char_line(), 'test')
    get_attr_KeyError(data_container(), 'somekey')
    get_attr_KeyError(char_map(), 'Stuff')
コード例 #3
0
ファイル: error_tests.py プロジェクト: FranziPl/tespy
def test_subsys_label_forbidden():
    subsystems.subsystem('label;')
コード例 #4
0
ファイル: error_tests.py プロジェクト: FranziPl/tespy
def test_subsys_label_str():
    subsystems.subsystem(5)
コード例 #5
0
def test_subsys_label_forbidden():
    with raises(ValueError):
        subsystems.subsystem('label;')
コード例 #6
0
def test_subsys_label_str():
    with raises(ValueError):
        subsystems.subsystem(5)