Skip to content

Commit

Permalink
Fixed test and pep
Browse files Browse the repository at this point in the history
  • Loading branch information
DKilkenny committed Nov 9, 2020
1 parent ea20363 commit 1ce42ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion openmdao/core/system.py
Expand Up @@ -3634,7 +3634,8 @@ def list_outputs(self,
impl_outputs = {}
if residuals_tol:
for n, m in outputs.items():
if "resids" in m and n in states and (n in states and m['resids'] > residuals_tol):
if "resids" in m and n in states and (n in states
and m['resids'] > residuals_tol):
impl_outputs[n] = m
else:
impl_outputs = {n: m for n, m in outputs.items() if n in states}
Expand Down
7 changes: 4 additions & 3 deletions openmdao/core/tests/test_impl_comp.py
Expand Up @@ -201,7 +201,7 @@ def test_list_outputs_before_run(self):
# list_outputs on a component before running is okay
c2_outputs = self.prob.model.comp2.list_outputs(out_stream=None)
expected = {
'x': {'value': [0.]}
'x': {'value': np.array([0.])}
}
self.assertEqual(dict(c2_outputs), expected)

Expand All @@ -216,9 +216,10 @@ def test_list_outputs_before_run(self):
c2_outputs = self.prob.model.comp2.list_outputs(excludes='x', out_stream=None)
self.assertEqual(dict(c2_outputs), {})

# specifying residuals_tol should not cause an error
# specifying residuals_tol should not cause an error. However this will be empty because
# of the residuals_tol
c2_outputs = self.prob.model.comp2.list_outputs(residuals_tol=.01, out_stream=None)
self.assertEqual(dict(c2_outputs), expected)
self.assertEqual(dict(c2_outputs), {})

# specifying prom_name should not cause an error
c2_outputs = self.prob.model.comp2.list_outputs(prom_name=True, out_stream=None)
Expand Down

0 comments on commit 1ce42ae

Please sign in to comment.