Skip to content

Commit

Permalink
Move dictionary inserts to its definition
Browse files Browse the repository at this point in the history
Instead of adding items to a dictionary just after creation, it should be refactored to add those items into the dict definition itself.
  • Loading branch information
deepsource-autofix[bot] authored and EwoutH committed May 3, 2022
1 parent 25529b8 commit b4ce855
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions test/test_util/test_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ def test_save_results(self):
)
outcome_q = np.random.rand(nr_experiments, 1)

outcomes = {}
outcomes[ScalarOutcome("q").name] = outcome_q
outcomes = {ScalarOutcome("q").name: outcome_q}
results = (experiments, outcomes)

# test for 2d
Expand All @@ -61,8 +60,7 @@ def test_save_results(self):
)
outcome_r = np.zeros((nr_experiments, nr_timesteps))

outcomes = {}
outcomes[ArrayOutcome("r").name] = outcome_r
outcomes = {ArrayOutcome("r").name: outcome_r}
results = (experiments, outcomes)

save_results(results, fn)
Expand All @@ -78,8 +76,7 @@ def test_save_results(self):
)
outcome_s = np.zeros((nr_experiments, nr_timesteps, nr_replications))

outcomes = {}
outcomes[ArrayOutcome("s").name] = outcome_s
outcomes = {ArrayOutcome("s").name: outcome_s}
results = (experiments, outcomes)

save_results(results, fn)
Expand All @@ -104,8 +101,7 @@ def test_load_results(self):

outcome_a = np.zeros((nr_experiments, 1))

outcomes = {}
outcomes[ArrayOutcome("a").name] = outcome_a
outcomes = {ArrayOutcome("a").name: outcome_a}
results = (experiments, outcomes)

save_results(results, "../data/test.tar.gz")
Expand All @@ -129,8 +125,7 @@ def test_load_results(self):

outcome_b = np.zeros((nr_experiments, nr_timesteps, nr_replications))

outcomes = {}
outcomes[ArrayOutcome("b").name] = outcome_b
outcomes = {ArrayOutcome("b").name: outcome_b}
results = (experiments, outcomes)

save_results(results, "../data/test.tar.gz")
Expand Down

0 comments on commit b4ce855

Please sign in to comment.