Skip to content

Commit

Permalink
Add mock function of get_output_dir()
Browse files Browse the repository at this point in the history
  • Loading branch information
IshaanDesai committed Dec 30, 2024
1 parent a17212b commit 742e86c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/unit/test_adaptivity_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def test_update_inactive_sims_global_adaptivity(self):

configurator = MagicMock()
configurator.get_adaptivity_similarity_measure = MagicMock(return_value="L1")
configurator.get_output_dir = MagicMock(return_value="output_dir")

adaptivity_controller = GlobalAdaptivityCalculator(
configurator, 5, global_ids, rank=self._rank, comm=self._comm
)
Expand Down Expand Up @@ -108,6 +110,7 @@ def test_update_all_active_sims_global_adaptivity(self):
configurator.get_adaptivity_refining_const = MagicMock(return_value=0.05)
configurator.get_adaptivity_coarsening_const = MagicMock(return_value=0.2)
configurator.get_adaptivity_similarity_measure = MagicMock(return_value="L2rel")
configurator.get_output_dir = MagicMock(return_value="output_dir")

adaptivity_controller = GlobalAdaptivityCalculator(
configurator, 5, global_ids, rank=self._rank, comm=self._comm
Expand Down Expand Up @@ -175,6 +178,8 @@ def test_communicate_micro_output(self):

configurator = MagicMock()
configurator.get_adaptivity_similarity_measure = MagicMock(return_value="L1")
configurator.get_output_dir = MagicMock(return_value="output_dir")

adaptivity_controller = GlobalAdaptivityCalculator(
configurator, 5, global_ids, rank=self._rank, comm=self._comm
)
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/test_adaptivity_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ def test_get_similarity_dists(self):
"""
configurator = MagicMock()
configurator.get_adaptivity_similarity_measure = MagicMock(return_value="L1")
configurator.get_output_dir = MagicMock(return_value="output_dir")

adaptivity_controller = AdaptivityCalculator(configurator, 0)
adaptivity_controller._hist_param = 0.5
adaptivity_controller._adaptivity_data_names = [
Expand Down Expand Up @@ -102,6 +104,8 @@ def test_update_active_sims(self):
"""
configurator = MagicMock()
configurator.get_adaptivity_similarity_measure = MagicMock(return_value="L1")
configurator.get_output_dir = MagicMock(return_value="output_dir")

adaptivity_controller = AdaptivityCalculator(configurator, 0)
adaptivity_controller._refine_const = self._refine_const
adaptivity_controller._coarse_const = self._coarse_const
Expand Down Expand Up @@ -208,6 +212,8 @@ def test_associate_active_to_inactive(self):
"""
configurator = MagicMock()
configurator.get_adaptivity_similarity_measure = MagicMock(return_value="L1")
configurator.get_output_dir = MagicMock(return_value="output_dir")

adaptivity_controller = AdaptivityCalculator(configurator, 0)
adaptivity_controller._refine_const = self._refine_const
adaptivity_controller._coarse_const = self._coarse_const
Expand Down Expand Up @@ -235,6 +241,8 @@ def test_update_inactive_sims_local_adaptivity(self):
"""
configurator = MagicMock()
configurator.get_adaptivity_similarity_measure = MagicMock(return_value="L1")
configurator.get_output_dir = MagicMock(return_value="output_dir")

adaptivity_controller = LocalAdaptivityCalculator(
configurator, 0, MagicMock(), 5
)
Expand Down

0 comments on commit 742e86c

Please sign in to comment.