Beispiel #1
0
    def test_assert_no_approx_partials_exception_not_expected(self):

        prob = Problem()
        prob.model = DoubleSellar()

        prob.setup(check=False)

        assert_no_approx_partials(prob.model, include_self=True, recurse=True)
Beispiel #2
0
    def test_assert_no_approx_partials_exception_not_expected(self):

        prob = Problem()
        prob.model = DoubleSellar()

        prob.setup(check=False)

        assert_no_approx_partials(prob.model, include_self=True, recurse=True)
    def test_assert_no_approx_partials_exception_expected(self):

        prob = om.Problem()
        prob.model = SellarNoDerivativesCS()

        prob.setup()

        try:
            assert_no_approx_partials(prob.model, include_self=True, recurse=True)

        except AssertionError as err:
            expected_err = \
'''The following components use approximated partials:
    cycle.d1
        of=*               wrt=*               method=cs
    cycle.d2
        of=*               wrt=*               method=cs
'''
            self.assertEqual(str(err), expected_err)
        else:
            self.fail('Exception expected.')
Beispiel #4
0
    def test_assert_no_approx_partials_exception_expected(self):

        prob = Problem()
        prob.model = SellarNoDerivativesCS()

        prob.setup(check=False)

        try:
            assert_no_approx_partials(prob.model, include_self=True, recurse=True)

        except AssertionError as err:
            expected_err = \
'''The following components use approximated partials:
    cycle.d1
        of=*               wrt=*               method=cs
    cycle.d2
        of=*               wrt=*               method=cs
'''
            self.assertEqual(str(err), expected_err)
        else:
            self.fail('Exception expected.')