""" Unit tests for the system interface."""

import unittest
from six import assertRaisesRegex
from six.moves import cStringIO

import numpy as np

from openmdao.api import Problem, Group, IndepVarComp, ExecComp
from openmdao.test_suite.components.options_feature_vector import VectorDoublingComp
from openmdao.utils.assert_utils import assert_rel_error, assert_warning


class TestSystem(unittest.TestCase):

    def test_vector_context_managers(self):
        g1 = Group()
        g1.add_subsystem('Indep', IndepVarComp('a', 5.0), promotes=['a'])
        g2 = g1.add_subsystem('G2', Group(), promotes=['*'])
        g2.add_subsystem('C1', ExecComp('b=2*a'), promotes=['a', 'b'])

        model = Group()
        model.add_subsystem('G1', g1, promotes=['b'])
        model.add_subsystem('Sink', ExecComp('c=2*b'), promotes=['b'])

        p = Problem(model=model)
        p.set_solver_print(level=0)

        # Test pre-setup errors
        with self.assertRaises(Exception) as cm:
            inputs, outputs, residuals = model.get_nonlinear_vectors()
        self.assertEqual(str(cm.exception),
                         "Group: Cannot get vectors because setup has not yet been called.")

        with self.assertRaises(Exception) as cm:
            d_inputs, d_outputs, d_residuals = model.get_linear_vectors('vec')
        self.assertEqual(str(cm.exception),
                         "Group: Cannot get vectors because setup has not yet been called.")

        p.setup()
        p.run_model()

        # Test inputs with original values
        inputs, outputs, residuals = model.get_nonlinear_vectors()
        self.assertEqual(inputs['G1.G2.C1.a'], 5.)

        inputs, outputs, residuals = g1.get_nonlinear_vectors()
        self.assertEqual(inputs['G2.C1.a'], 5.)

        # Test inputs after setting a new value
        inputs, outputs, residuals = g2.get_nonlinear_vectors()
        inputs['C1.a'] = -1.

        inputs, outputs, residuals = model.get_nonlinear_vectors()
        self.assertEqual(inputs['G1.G2.C1.a'], -1.)

        inputs, outputs, residuals = g1.get_nonlinear_vectors()
        self.assertEqual(inputs['G2.C1.a'], -1.)

        # Test outputs with original values
        inputs, outputs, residuals = model.get_nonlinear_vectors()
        self.assertEqual(outputs['G1.G2.C1.b'], 10.)

        inputs, outputs, residuals = g2.get_nonlinear_vectors()

        # Test outputs after setting a new value
        inputs, outputs, residuals = model.get_nonlinear_vectors()
        outputs['G1.G2.C1.b'] = 123.
        self.assertEqual(outputs['G1.G2.C1.b'], 123.)

        inputs, outputs, residuals = g2.get_nonlinear_vectors()
        outputs['C1.b'] = 789.
        self.assertEqual(outputs['C1.b'], 789.)

        # Test residuals
        inputs, outputs, residuals = model.get_nonlinear_vectors()
        residuals['G1.G2.C1.b'] = 99.0
        self.assertEqual(residuals['G1.G2.C1.b'], 99.0)

        # Test linear
        d_inputs, d_outputs, d_residuals = model.get_linear_vectors('linear')
        d_outputs['G1.G2.C1.b'] = 10.
        self.assertEqual(d_outputs['G1.G2.C1.b'], 10.)

        # Test linear with invalid vec_name
        with self.assertRaises(Exception) as cm:
            d_inputs, d_outputs, d_residuals = model.get_linear_vectors('bad_name')
        self.assertEqual(str(cm.exception),
                         "Group (<model>): There is no linear vector named %s" % 'bad_name')

    def test_set_checks_shape(self):
        indep = IndepVarComp()
        indep.add_output('a')
        indep.add_output('x', shape=(5, 1))

        g1 = Group()
        g1.add_subsystem('Indep', indep, promotes=['a', 'x'])

        g2 = g1.add_subsystem('G2', Group(), promotes=['*'])
        g2.add_subsystem('C1', ExecComp('b=2*a'), promotes=['a', 'b'])
        g2.add_subsystem('C2', ExecComp('y=2*x',
                                        x=np.zeros((5, 1)),
                                        y=np.zeros((5, 1))),
                                        promotes=['x', 'y'])

        model = Group()
        model.add_subsystem('G1', g1, promotes=['b', 'y'])
        model.add_subsystem('Sink', ExecComp(('c=2*b', 'z=2*y'),
                                             y=np.zeros((5, 1)),
                                             z=np.zeros((5, 1))),
                                             promotes=['b', 'y'])

        p = Problem(model=model)
        p.setup()

        p.set_solver_print(level=0)
        p.run_model()

        msg = "Incompatible shape for '.*': Expected (.*) but got (.*)"

        num_val = -10
        arr_val = -10*np.ones((5, 1))
        bad_val = -10*np.ones((10))

        inputs, outputs, residuals = g2.get_nonlinear_vectors()
        #
        # set input
        #

        # assign array to scalar
        with assertRaisesRegex(self, ValueError, msg):
            inputs['C1.a'] = arr_val

        # assign scalar to array
        inputs['C2.x'] = num_val
        assert_rel_error(self, inputs['C2.x'], arr_val, 1e-10)

        # assign array to array
        inputs['C2.x'] = arr_val
        assert_rel_error(self, inputs['C2.x'], arr_val, 1e-10)

        # assign bad array shape to array
        with assertRaisesRegex(self, ValueError, msg):
            inputs['C2.x'] = bad_val

        # assign list to array
        inputs['C2.x'] = arr_val.tolist()
        assert_rel_error(self, inputs['C2.x'], arr_val, 1e-10)

        # assign bad list shape to array
        with assertRaisesRegex(self, ValueError, msg):
            inputs['C2.x'] = bad_val.tolist()

        #
        # set output
        #

        # assign array to scalar
        with assertRaisesRegex(self, ValueError, msg):
            outputs['C1.b'] = arr_val

        # assign scalar to array
        outputs['C2.y'] = num_val
        assert_rel_error(self, outputs['C2.y'], arr_val, 1e-10)

        # assign array to array
        outputs['C2.y'] = arr_val
        assert_rel_error(self, outputs['C2.y'], arr_val, 1e-10)

        # assign bad array shape to array
        with assertRaisesRegex(self, ValueError, msg):
            outputs['C2.y'] = bad_val

        # assign list to array
        outputs['C2.y'] = arr_val.tolist()
        assert_rel_error(self, outputs['C2.y'], arr_val, 1e-10)

        # assign bad list shape to array
        with assertRaisesRegex(self, ValueError, msg):
            outputs['C2.y'] = bad_val.tolist()

        #
        # set residual
        #

        # assign array to scalar
        with assertRaisesRegex(self, ValueError, msg):
            residuals['C1.b'] = arr_val

        # assign scalar to array
        residuals['C2.y'] = num_val
        assert_rel_error(self, residuals['C2.y'], arr_val, 1e-10)

        # assign array to array
        residuals['C2.y'] = arr_val
        assert_rel_error(self, residuals['C2.y'], arr_val, 1e-10)

        # assign bad array shape to array
        with assertRaisesRegex(self, ValueError, msg):
            residuals['C2.y'] = bad_val

        # assign list to array
        residuals['C2.y'] = arr_val.tolist()
        assert_rel_error(self, residuals['C2.y'], arr_val, 1e-10)

        # assign bad list shape to array
        with assertRaisesRegex(self, ValueError, msg):
            residuals['C2.y'] = bad_val.tolist()

    def test_deprecated_solver_names(self):
        class DummySolver():
            pass

        model = Group()

        # check nl_solver setter & getter
        msg = "The 'nl_solver' attribute provides backwards compatibility " \
              "with OpenMDAO 1.x ; use 'nonlinear_solver' instead."

        with assert_warning(DeprecationWarning, msg):
            model.nl_solver = DummySolver()

        with assert_warning(DeprecationWarning, msg):
            solver = model.nl_solver

        self.assertTrue(isinstance(solver, DummySolver))

        # check ln_solver setter & getter
        msg = "The 'ln_solver' attribute provides backwards compatibility " \
              "with OpenMDAO 1.x ; use 'linear_solver' instead."

        with assert_warning(DeprecationWarning, msg):
            model.ln_solver = DummySolver()

        with assert_warning(DeprecationWarning, msg):
            solver = model.ln_solver

        self.assertTrue(isinstance(solver, DummySolver))

    def test_deprecated_metadata(self):
        prob = Problem()
        prob.model.add_subsystem('inputs', IndepVarComp('x', shape=3))
        prob.model.add_subsystem('double', VectorDoublingComp())

        msg = "The 'metadata' attribute provides backwards compatibility " \
              "with earlier version of OpenMDAO; use 'options' instead."

        with assert_warning(DeprecationWarning, msg):
            prob.model.double.metadata['size'] = 3

        prob.model.connect('inputs.x', 'double.x')
        prob.setup()

        prob['inputs.x'] = [1., 2., 3.]

        prob.run_model()
        assert_rel_error(self, prob['double.y'], [2., 4., 6.])

    def test_list_inputs_output_with_includes_excludes(self):
        from openmdao.test_suite.scripts.circuit_analysis import Resistor, Diode, Node, Circuit

        p = Problem()
        model = p.model

        model.add_subsystem('ground', IndepVarComp('V', 0., units='V'))
        model.add_subsystem('source', IndepVarComp('I', 0.1, units='A'))
        model.add_subsystem('circuit', Circuit())

        model.connect('source.I', 'circuit.I_in')
        model.connect('ground.V', 'circuit.Vg')

        p.setup()
        p.run_model()

        # Inputs with no includes or excludes
        inputs = model.list_inputs(out_stream=None)
        self.assertEqual( len(inputs), 11)

        # Inputs with includes
        inputs = model.list_inputs(includes=['*V_out*'], out_stream=None)
        self.assertEqual( len(inputs), 3)

        # Inputs with includes matching a promoted name
        inputs = model.list_inputs(includes=['*Vg*'], out_stream=None)
        self.assertEqual( len(inputs), 2)

        # Inputs with excludes
        inputs = model.list_inputs(excludes=['*V_out*'], out_stream=None)
        self.assertEqual( len(inputs), 8)

        # Inputs with excludes matching a promoted name
        inputs = model.list_inputs(excludes=['*Vg*'], out_stream=None)
        self.assertEqual( len(inputs), 9)

        # Inputs with includes and excludes
        inputs = model.list_inputs(includes=['*V_out*'], excludes=['*Vg*'], out_stream=None)
        self.assertEqual( len(inputs), 1)


        # Outputs with no includes or excludes. Explicit only
        outputs = model.list_outputs(implicit=False, out_stream=None)
        self.assertEqual( len(outputs), 5)

        # Outputs with includes. Explicit only
        outputs = model.list_outputs(includes=['*I'], implicit=False, out_stream=None)
        self.assertEqual( len(outputs), 4)

        # Outputs with excludes. Explicit only
        outputs = model.list_outputs(excludes=['circuit*'], implicit=False, out_stream=None)
        self.assertEqual( len(outputs), 2)

if __name__ == "__main__":
    unittest.main()

[((313, 4, 313, 19), 'unittest.main', 'unittest.main', ({}, {}), '()', False, 'import unittest\n'), ((17, 13, 17, 20), 'openmdao.api.Group', 'Group', ({}, {}), '()', False, 'from openmdao.api import Problem, Group, IndepVarComp, ExecComp\n'), ((22, 16, 22, 23), 'openmdao.api.Group', 'Group', ({}, {}), '()', False, 'from openmdao.api import Problem, Group, IndepVarComp, ExecComp\n'), ((26, 12, 26, 32), 'openmdao.api.Problem', 'Problem', (), '', False, 'from openmdao.api import Problem, Group, IndepVarComp, ExecComp\n'), ((92, 16, 92, 30), 'openmdao.api.IndepVarComp', 'IndepVarComp', ({}, {}), '()', False, 'from openmdao.api import Problem, Group, IndepVarComp, ExecComp\n'), ((96, 13, 96, 20), 'openmdao.api.Group', 'Group', ({}, {}), '()', False, 'from openmdao.api import Problem, Group, IndepVarComp, ExecComp\n'), ((106, 16, 106, 23), 'openmdao.api.Group', 'Group', ({}, {}), '()', False, 'from openmdao.api import Problem, Group, IndepVarComp, ExecComp\n'), ((113, 12, 113, 32), 'openmdao.api.Problem', 'Problem', (), '', False, 'from openmdao.api import Problem, Group, IndepVarComp, ExecComp\n'), ((136, 8, 136, 62), 'openmdao.utils.assert_utils.assert_rel_error', 'assert_rel_error', ({(136, 25, 136, 29): 'self', (136, 31, 136, 45): "inputs['C2.x']", (136, 47, 136, 54): 'arr_val', (136, 56, 136, 61): '(1e-10)'}, {}), "(self, inputs['C2.x'], arr_val, 1e-10)", False, 'from openmdao.utils.assert_utils import assert_rel_error, assert_warning\n'), ((140, 8, 140, 62), 'openmdao.utils.assert_utils.assert_rel_error', 'assert_rel_error', ({(140, 25, 140, 29): 'self', (140, 31, 140, 45): "inputs['C2.x']", (140, 47, 140, 54): 'arr_val', (140, 56, 140, 61): '(1e-10)'}, {}), "(self, inputs['C2.x'], arr_val, 1e-10)", False, 'from openmdao.utils.assert_utils import assert_rel_error, assert_warning\n'), ((148, 8, 148, 62), 'openmdao.utils.assert_utils.assert_rel_error', 'assert_rel_error', ({(148, 25, 148, 29): 'self', (148, 31, 148, 45): "inputs['C2.x']", (148, 47, 148, 54): 'arr_val', (148, 56, 148, 61): '(1e-10)'}, {}), "(self, inputs['C2.x'], arr_val, 1e-10)", False, 'from openmdao.utils.assert_utils import assert_rel_error, assert_warning\n'), ((164, 8, 164, 63), 'openmdao.utils.assert_utils.assert_rel_error', 'assert_rel_error', ({(164, 25, 164, 29): 'self', (164, 31, 164, 46): "outputs['C2.y']", (164, 48, 164, 55): 'arr_val', (164, 57, 164, 62): '(1e-10)'}, {}), "(self, outputs['C2.y'], arr_val, 1e-10)", False, 'from openmdao.utils.assert_utils import assert_rel_error, assert_warning\n'), ((168, 8, 168, 63), 'openmdao.utils.assert_utils.assert_rel_error', 'assert_rel_error', ({(168, 25, 168, 29): 'self', (168, 31, 168, 46): "outputs['C2.y']", (168, 48, 168, 55): 'arr_val', (168, 57, 168, 62): '(1e-10)'}, {}), "(self, outputs['C2.y'], arr_val, 1e-10)", False, 'from openmdao.utils.assert_utils import assert_rel_error, assert_warning\n'), ((176, 8, 176, 63), 'openmdao.utils.assert_utils.assert_rel_error', 'assert_rel_error', ({(176, 25, 176, 29): 'self', (176, 31, 176, 46): "outputs['C2.y']", (176, 48, 176, 55): 'arr_val', (176, 57, 176, 62): '(1e-10)'}, {}), "(self, outputs['C2.y'], arr_val, 1e-10)", False, 'from openmdao.utils.assert_utils import assert_rel_error, assert_warning\n'), ((192, 8, 192, 65), 'openmdao.utils.assert_utils.assert_rel_error', 'assert_rel_error', ({(192, 25, 192, 29): 'self', (192, 31, 192, 48): "residuals['C2.y']", (192, 50, 192, 57): 'arr_val', (192, 59, 192, 64): '(1e-10)'}, {}), "(self, residuals['C2.y'], arr_val, 1e-10)", False, 'from openmdao.utils.assert_utils import assert_rel_error, assert_warning\n'), ((196, 8, 196, 65), 'openmdao.utils.assert_utils.assert_rel_error', 'assert_rel_error', ({(196, 25, 196, 29): 'self', (196, 31, 196, 48): "residuals['C2.y']", (196, 50, 196, 57): 'arr_val', (196, 59, 196, 64): '(1e-10)'}, {}), "(self, residuals['C2.y'], arr_val, 1e-10)", False, 'from openmdao.utils.assert_utils import assert_rel_error, assert_warning\n'), ((204, 8, 204, 65), 'openmdao.utils.assert_utils.assert_rel_error', 'assert_rel_error', ({(204, 25, 204, 29): 'self', (204, 31, 204, 48): "residuals['C2.y']", (204, 50, 204, 57): 'arr_val', (204, 59, 204, 64): '(1e-10)'}, {}), "(self, residuals['C2.y'], arr_val, 1e-10)", False, 'from openmdao.utils.assert_utils import assert_rel_error, assert_warning\n'), ((214, 16, 214, 23), 'openmdao.api.Group', 'Group', ({}, {}), '()', False, 'from openmdao.api import Problem, Group, IndepVarComp, ExecComp\n'), ((241, 15, 241, 24), 'openmdao.api.Problem', 'Problem', ({}, {}), '()', False, 'from openmdao.api import Problem, Group, IndepVarComp, ExecComp\n'), ((257, 8, 257, 62), 'openmdao.utils.assert_utils.assert_rel_error', 'assert_rel_error', ({(257, 25, 257, 29): 'self', (257, 31, 257, 47): "prob['double.y']", (257, 49, 257, 61): '[2.0, 4.0, 6.0]'}, {}), "(self, prob['double.y'], [2.0, 4.0, 6.0])", False, 'from openmdao.utils.assert_utils import assert_rel_error, assert_warning\n'), ((262, 12, 262, 21), 'openmdao.api.Problem', 'Problem', ({}, {}), '()', False, 'from openmdao.api import Problem, Group, IndepVarComp, ExecComp\n'), ((18, 34, 18, 56), 'openmdao.api.IndepVarComp', 'IndepVarComp', ({(18, 47, 18, 50): '"""a"""', (18, 52, 18, 55): '(5.0)'}, {}), "('a', 5.0)", False, 'from openmdao.api import Problem, Group, IndepVarComp, ExecComp\n'), ((19, 36, 19, 43), 'openmdao.api.Group', 'Group', ({}, {}), '()', False, 'from openmdao.api import Problem, Group, IndepVarComp, ExecComp\n'), ((20, 31, 20, 48), 'openmdao.api.ExecComp', 'ExecComp', ({(20, 40, 20, 47): '"""b=2*a"""'}, {}), "('b=2*a')", False, 'from openmdao.api import Problem, Group, IndepVarComp, ExecComp\n'), ((24, 36, 24, 53), 'openmdao.api.ExecComp', 'ExecComp', ({(24, 45, 24, 52): '"""c=2*b"""'}, {}), "('c=2*b')", False, 'from openmdao.api import Problem, Group, IndepVarComp, ExecComp\n'), ((99, 36, 99, 43), 'openmdao.api.Group', 'Group', ({}, {}), '()', False, 'from openmdao.api import Problem, Group, IndepVarComp, ExecComp\n'), ((100, 31, 100, 48), 'openmdao.api.ExecComp', 'ExecComp', ({(100, 40, 100, 47): '"""b=2*a"""'}, {}), "('b=2*a')", False, 'from openmdao.api import Problem, Group, IndepVarComp, ExecComp\n'), ((122, 22, 122, 37), 'numpy.ones', 'np.ones', ({(122, 30, 122, 36): '(5, 1)'}, {}), '((5, 1))', True, 'import numpy as np\n'), ((123, 22, 123, 35), 'numpy.ones', 'np.ones', ({(123, 31, 123, 33): '(10)'}, {}), '(10)', True, 'import numpy as np\n'), ((131, 13, 131, 53), 'six.assertRaisesRegex', 'assertRaisesRegex', ({(131, 31, 131, 35): 'self', (131, 37, 131, 47): 'ValueError', (131, 49, 131, 52): 'msg'}, {}), '(self, ValueError, msg)', False, 'from six import assertRaisesRegex\n'), ((143, 13, 143, 53), 'six.assertRaisesRegex', 'assertRaisesRegex', ({(143, 31, 143, 35): 'self', (143, 37, 143, 47): 'ValueError', (143, 49, 143, 52): 'msg'}, {}), '(self, ValueError, msg)', False, 'from six import assertRaisesRegex\n'), ((151, 13, 151, 53), 'six.assertRaisesRegex', 'assertRaisesRegex', ({(151, 31, 151, 35): 'self', (151, 37, 151, 47): 'ValueError', (151, 49, 151, 52): 'msg'}, {}), '(self, ValueError, msg)', False, 'from six import assertRaisesRegex\n'), ((159, 13, 159, 53), 'six.assertRaisesRegex', 'assertRaisesRegex', ({(159, 31, 159, 35): 'self', (159, 37, 159, 47): 'ValueError', (159, 49, 159, 52): 'msg'}, {}), '(self, ValueError, msg)', False, 'from six import assertRaisesRegex\n'), ((171, 13, 171, 53), 'six.assertRaisesRegex', 'assertRaisesRegex', ({(171, 31, 171, 35): 'self', (171, 37, 171, 47): 'ValueError', (171, 49, 171, 52): 'msg'}, {}), '(self, ValueError, msg)', False, 'from six import assertRaisesRegex\n'), ((179, 13, 179, 53), 'six.assertRaisesRegex', 'assertRaisesRegex', ({(179, 31, 179, 35): 'self', (179, 37, 179, 47): 'ValueError', (179, 49, 179, 52): 'msg'}, {}), '(self, ValueError, msg)', False, 'from six import assertRaisesRegex\n'), ((187, 13, 187, 53), 'six.assertRaisesRegex', 'assertRaisesRegex', ({(187, 31, 187, 35): 'self', (187, 37, 187, 47): 'ValueError', (187, 49, 187, 52): 'msg'}, {}), '(self, ValueError, msg)', False, 'from six import assertRaisesRegex\n'), ((199, 13, 199, 53), 'six.assertRaisesRegex', 'assertRaisesRegex', ({(199, 31, 199, 35): 'self', (199, 37, 199, 47): 'ValueError', (199, 49, 199, 52): 'msg'}, {}), '(self, ValueError, msg)', False, 'from six import assertRaisesRegex\n'), ((207, 13, 207, 53), 'six.assertRaisesRegex', 'assertRaisesRegex', ({(207, 31, 207, 35): 'self', (207, 37, 207, 47): 'ValueError', (207, 49, 207, 52): 'msg'}, {}), '(self, ValueError, msg)', False, 'from six import assertRaisesRegex\n'), ((220, 13, 220, 52), 'openmdao.utils.assert_utils.assert_warning', 'assert_warning', ({(220, 28, 220, 46): 'DeprecationWarning', (220, 48, 220, 51): 'msg'}, {}), '(DeprecationWarning, msg)', False, 'from openmdao.utils.assert_utils import assert_rel_error, assert_warning\n'), ((223, 13, 223, 52), 'openmdao.utils.assert_utils.assert_warning', 'assert_warning', ({(223, 28, 223, 46): 'DeprecationWarning', (223, 48, 223, 51): 'msg'}, {}), '(DeprecationWarning, msg)', False, 'from openmdao.utils.assert_utils import assert_rel_error, assert_warning\n'), ((232, 13, 232, 52), 'openmdao.utils.assert_utils.assert_warning', 'assert_warning', ({(232, 28, 232, 46): 'DeprecationWarning', (232, 48, 232, 51): 'msg'}, {}), '(DeprecationWarning, msg)', False, 'from openmdao.utils.assert_utils import assert_rel_error, assert_warning\n'), ((235, 13, 235, 52), 'openmdao.utils.assert_utils.assert_warning', 'assert_warning', ({(235, 28, 235, 46): 'DeprecationWarning', (235, 48, 235, 51): 'msg'}, {}), '(DeprecationWarning, msg)', False, 'from openmdao.utils.assert_utils import assert_rel_error, assert_warning\n'), ((242, 43, 242, 69), 'openmdao.api.IndepVarComp', 'IndepVarComp', (), '', False, 'from openmdao.api import Problem, Group, IndepVarComp, ExecComp\n'), ((243, 43, 243, 63), 'openmdao.test_suite.components.options_feature_vector.VectorDoublingComp', 'VectorDoublingComp', ({}, {}), '()', False, 'from openmdao.test_suite.components.options_feature_vector import VectorDoublingComp\n'), ((248, 13, 248, 52), 'openmdao.utils.assert_utils.assert_warning', 'assert_warning', ({(248, 28, 248, 46): 'DeprecationWarning', (248, 48, 248, 51): 'msg'}, {}), '(DeprecationWarning, msg)', False, 'from openmdao.utils.assert_utils import assert_rel_error, assert_warning\n'), ((265, 38, 265, 70), 'openmdao.api.IndepVarComp', 'IndepVarComp', (), '', False, 'from openmdao.api import Problem, Group, IndepVarComp, ExecComp\n'), ((266, 38, 266, 71), 'openmdao.api.IndepVarComp', 'IndepVarComp', (), '', False, 'from openmdao.api import Problem, Group, IndepVarComp, ExecComp\n'), ((267, 39, 267, 48), 'openmdao.test_suite.scripts.circuit_analysis.Circuit', 'Circuit', ({}, {}), '()', False, 'from openmdao.test_suite.scripts.circuit_analysis import Resistor, Diode, Node, Circuit\n'), ((102, 42, 102, 58), 'numpy.zeros', 'np.zeros', ({(102, 51, 102, 57): '(5, 1)'}, {}), '((5, 1))', True, 'import numpy as np\n'), ((103, 42, 103, 58), 'numpy.zeros', 'np.zeros', ({(103, 51, 103, 57): '(5, 1)'}, {}), '((5, 1))', True, 'import numpy as np\n'), ((109, 47, 109, 63), 'numpy.zeros', 'np.zeros', ({(109, 56, 109, 62): '(5, 1)'}, {}), '((5, 1))', True, 'import numpy as np\n'), ((110, 47, 110, 63), 'numpy.zeros', 'np.zeros', ({(110, 56, 110, 62): '(5, 1)'}, {}), '((5, 1))', True, 'import numpy as np\n')]