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')
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')
def test_subsys_label_forbidden(): subsystems.subsystem('label;')
def test_subsys_label_str(): subsystems.subsystem(5)
def test_subsys_label_forbidden(): with raises(ValueError): subsystems.subsystem('label;')
def test_subsys_label_str(): with raises(ValueError): subsystems.subsystem(5)