Skip to content

Commit

Permalink
better message for this usage error
Browse files Browse the repository at this point in the history
  • Loading branch information
wumpus committed May 15, 2021
1 parent d4b2656 commit b0f8363
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions paramsurvey/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ def product_step(a, df):

if not is_category:
a = _coerce_to_category(series)
else:
raise ValueError('invalid type {} in product construction'.format(type(a)))

dfa = pd.DataFrame(a)
dfa['asdfasdf'] = 0
Expand Down
4 changes: 4 additions & 0 deletions test/unit/test_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ def test_product():
assert len(df) == 8
assert df['col3'].dtype == 'category', 'sending in a category works'

ps3 = 3
with pytest.raises(ValueError):
df = paramsurvey.params.product(df1, df2, ps3)


def test_add_column():
df = paramsurvey.params.product({'col1': [1, 2]}, {'col2': [3, 4]}, {'col3': [5, 6]})
Expand Down

0 comments on commit b0f8363

Please sign in to comment.