Ejemplo n.º 1
0
    def test_network_reader_no_chars_busses(self):
        """Test import of network without characteristics or busses."""
        self.setup_network_tests()
        a = connection(self.source, 'out1', self.sink, 'in1')
        self.nw.add_conns(a)
        self.nw.solve('design', init_only=True)
        self.nw.save('tmp')

        imported_nwk = load_network('tmp')
        imported_nwk.solve('design', init_only=True)
        msg = ('If the network import was successful the network check '
               'should have been successful, too, but it is not.')
        assert imported_nwk.checked is True, msg
        shutil.rmtree('./tmp', ignore_errors=True)
Ejemplo n.º 2
0
    def test_network_reader_deleted_chars(self):
        """Test import of network with missing characteristics."""
        self.setup_network_tests()
        comp = turbomachinery.compressor('compressor')
        a = connection(self.source, 'out1', comp, 'in1')
        b = connection(comp, 'out1', self.sink, 'in1')
        self.nw.add_conns(a, b)
        self.nw.solve('design', init_only=True)
        self.nw.save('tmp')

        # # remove char_line and char_map folders
        os.unlink('tmp/components/char_line.csv')
        os.unlink('tmp/components/char_map.csv')

        # import network with missing files
        imported_nwk = load_network('tmp')
        imported_nwk.solve('design', init_only=True)
        msg = ('If the network import was successful the network check '
               'should have been successful, too, but it is not.')
        assert imported_nwk.checked is True, msg
        shutil.rmtree('./tmp', ignore_errors=True)