Skip to content

Commit

Permalink
Merge pull request #111 from marrink-lab/faster-hyo2
Browse files Browse the repository at this point in the history
Limit invalid cases in generate_diff_dict
  • Loading branch information
pckroon committed Sep 13, 2018
2 parents 315b20e + 5c5df49 commit 9d52775
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions vermouth/tests/gmx/test_gro.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,14 +455,17 @@ def generate_diff_dict(draw):
st.text(), st.integers(), st.floats(),
hnp.arrays(dtype=hnp.scalar_dtypes(), shape=hnp.array_shapes())
)
for _ in range(draw(st.integers(min_value=1, max_value=len(dict_b)))):
num_to_change = draw(st.integers(
min_value=1, max_value=(len(dict_b) // 2) + 1
))
for _ in range(num_to_change):
key = draw(st.sampled_from(list(dict_b.keys())))
new_val = draw(values)
assume(are_different(new_val, dict_b[key]))
assume(are_different(new_val, dict_a[key]))
dict_b[key] = new_val
dict_c = draw(generate_dict())
assume(dict_c.keys() - dict_b.keys())
dict_b.update(dict_c)
for key in set(dict_c.keys()) - set(dict_b.keys()):
dict_b[key] = dict_c[key]
return dict_a, dict_b


Expand Down

0 comments on commit 9d52775

Please sign in to comment.