Skip to content

Commit

Permalink
fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
swryan committed Sep 27, 2023
1 parent 56a970a commit c69829d
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions openmdao/visualization/n2_viewer/tests/test_viewmodeldata.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@ def compute(self, inputs, outputs):

def test_viewer_data_with_submodel(self):

self.maxDiff = None

def check_viewer_data_with_submodel(sql_filename):
# create sub problem
submodel = om.Group()
Expand All @@ -356,11 +358,11 @@ def check_viewer_data_with_submodel(sql_filename):
# create top-level problem
p = om.Problem(name='top')
p.model.add_subsystem('submodelcomp',
om.SubmodelComp(problem=subprob, inputs=['*'], outputs=['*']),
promotes=['*'])
om.SubmodelComp(problem=subprob, inputs=['*'], outputs=['*']),
promotes=['*'])
p.model.add_subsystem('supercomp',
om.ExecComp('z = 3 * y'),
promotes=['*'])
om.ExecComp('z = 3 * y'),
promotes=['*'])

p.model.add_recorder(om.SqliteRecorder(sql_filename))

Expand All @@ -369,18 +371,16 @@ def check_viewer_data_with_submodel(sql_filename):

# extract viewer data from N2 for problem and subproblem
om.n2(p, title='N2 for Problem', outfile='N2problem.html',
show_browser=DEBUG_BROWSER)
show_browser=DEBUG_BROWSER)
problem_data = extract_compressed_model('N2problem.html')

om.n2(subprob, title='N2 for SubProblem', outfile='N2subprob.html',
show_browser=DEBUG_BROWSER)
show_browser=DEBUG_BROWSER)
subprob_data = extract_compressed_model('N2subprob.html')

self.maxDiff = None

# check problem data generated from recording against data generated from problem
check_call(f"openmdao n2 {sql_filename} -o N2recording.html"
f"{' --no_browser' if not DEBUG_BROWSER else ''}")
f"{' --no_browser' if not DEBUG_BROWSER else ''}")
recording_data = extract_compressed_model('N2recording.html')

self.assertDictEqual(problem_data, recording_data)
Expand Down Expand Up @@ -419,7 +419,7 @@ def check_viewer_data_with_submodel(sql_filename):

# check problem data generated from script against data generated from problem
check_call("openmdao n2 submodel_script.py -o N2_top.html"
f"{' --no_browser' if not DEBUG_BROWSER else ''}")
f"{' --no_browser' if not DEBUG_BROWSER else ''}")
n2_top_data = extract_compressed_model('N2_top.html')

self.assertDictEqual(problem_data, n2_top_data)
Expand All @@ -428,7 +428,7 @@ def check_viewer_data_with_submodel(sql_filename):
# NOTE: design vars and responses are added in SubmodelComp's setup, which is not executed
# when invoking the n2 command on the subproblem, which exits after subproblem setup
check_call("openmdao n2 submodel_script.py -o N2_subprob.html --problem=subproblem"
f"{' --no_browser' if not DEBUG_BROWSER else ''}")
f"{' --no_browser' if not DEBUG_BROWSER else ''}")
n2_sub_data = extract_compressed_model('N2_subprob.html')

subprob_data['design_vars'] = {}
Expand Down

0 comments on commit c69829d

Please sign in to comment.