コード例 #1
0
    def test_model_remove_component_argument_all(self):
        """Should remove an argument in an existing component."""
        # Setup
        source_file = os.path.join(self.data_dir, 'DCMotor.mo')
        model = Model(source_file)

        # Act
        model.remove_component_argument('VsourceDC', 'DC', 'f')
        self.result = model.execute()

        # Assert
        self.assertHasAdditions(source_file, self.result, [' VsourceDC DC();'])
        self.assertHasDeletions(source_file, self.result, ['f=10'])
コード例 #2
0
    def test_model_remove_component_argument_last(self):
        """Should remove an argument in an existing component."""
        # Setup
        source_file = os.path.join(self.data_dir, 'DCMotor.mo')
        model = Model(source_file)

        # Act
        model.remove_component_argument('ElectroMechanicalElement', 'EM', 'b')
        self.result = model.execute()

        # Assert
        self.assertHasAdditions(source_file, self.result,
                                ['ElectroMechanicalElement EM(k=10, J=10 );'])
        self.assertHasDeletions(source_file, self.result, ['b=2'])