Skip to content

Commit

Permalink
Minor fix for tests. Assumption that report problem directories were …
Browse files Browse the repository at this point in the history
…already sorted is not always true.
  • Loading branch information
robfalck committed Jul 22, 2022
1 parent 912135d commit 714f244
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def tearDown(self):
def test_no_sim_reports(self):
p = setup_model_radau(do_reports=False)

report_subdirs = [e for e in pathlib.Path(get_reports_dir()).iterdir() if e.is_dir()]
report_subdirs = sorted([e for e in pathlib.Path(get_reports_dir()).iterdir() if e.is_dir()])

# Test that a report subdir was made
self.assertEqual(len(report_subdirs), 1)
Expand All @@ -167,7 +167,7 @@ def test_no_sim_reports(self):
def test_make_sim_reports(self):
p = setup_model_radau(do_reports=True)

report_subdirs = [e for e in pathlib.Path(get_reports_dir()).iterdir() if e.is_dir()]
report_subdirs = sorted([e for e in pathlib.Path(get_reports_dir()).iterdir() if e.is_dir()])

# Test that a report subdir was made
# # There is the nominal problem, the simulation problem, and a subproblem for each segment in the simulation.
Expand All @@ -181,7 +181,7 @@ def test_make_sim_reports(self):
def test_explicitshooting_no_subprob_reports(self):
p = setup_model_shooting(do_reports=False)

report_subdirs = [e for e in pathlib.Path(get_reports_dir()).iterdir() if e.is_dir()]
report_subdirs = sorted([e for e in pathlib.Path(get_reports_dir()).iterdir() if e.is_dir()])

# Test that a report subdir was made
self.assertEqual(len(report_subdirs), 1)
Expand All @@ -195,7 +195,7 @@ def test_explicitshooting_no_subprob_reports(self):
def test_explicitshooting_make_subprob_reports(self):
p = setup_model_shooting(do_reports=True)

report_subdirs = [e for e in pathlib.Path(get_reports_dir()).iterdir() if e.is_dir()]
report_subdirs = sorted([e for e in pathlib.Path(get_reports_dir()).iterdir() if e.is_dir()])

# Test that a report subdir was made
# There is the nominal problem, a subproblem for integration, and a subproblem for the derivatives.
Expand Down Expand Up @@ -246,7 +246,7 @@ def test_no_sim_reports(self):
p = setup_model_radau(do_reports=False)

problem_reports_dir = pathlib.Path(_reports_dir).joinpath(p._name)
report_subdirs = [e for e in pathlib.Path(_reports_dir).iterdir() if e.is_dir()]
report_subdirs = sorted([e for e in pathlib.Path(_reports_dir).iterdir() if e.is_dir()])

# Test that a report subdir was made
self.assertEqual(len(report_subdirs), 1)
Expand All @@ -262,7 +262,7 @@ def test_make_sim_reports(self):

p = setup_model_radau(do_reports=True)

report_subdirs = [e for e in pathlib.Path(_reports_dir).iterdir() if e.is_dir()]
report_subdirs = sorted([e for e in pathlib.Path(_reports_dir).iterdir() if e.is_dir()])

# Test that a report subdir was made
# # There is the nominal problem, the simulation problem, and a subproblem for each segment in the simulation.
Expand All @@ -279,7 +279,7 @@ def test_explicitshooting_no_subprob_reports(self):
p = setup_model_shooting(do_reports=False)

problem_reports_dir = pathlib.Path(_reports_dir).joinpath(p._name)
report_subdirs = [e for e in pathlib.Path(_reports_dir).iterdir() if e.is_dir()]
report_subdirs = sorted([e for e in pathlib.Path(_reports_dir).iterdir() if e.is_dir()])

# Test that a report subdir was made
self.assertEqual(len(report_subdirs), 1)
Expand All @@ -296,7 +296,7 @@ def test_explicitshooting_make_subprob_reports(self):
p = setup_model_shooting(do_reports=True)

problem_reports_dir = pathlib.Path(_reports_dir).joinpath(p._name)
report_subdirs = [e for e in pathlib.Path(_reports_dir).iterdir() if e.is_dir()]
report_subdirs = sorted([e for e in pathlib.Path(_reports_dir).iterdir() if e.is_dir()])

# Test that a report subdir was made
# There is the nominal problem, a subproblem for integration, and a subproblem for the derivatives.
Expand Down

0 comments on commit 714f244

Please sign in to comment.