-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Add check for array lengths in from_arrays method (GH13599) #13633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
ff5ef13
db98e32
5e7bd92
27d2915
06103dd
7dd4091
20de266
4a9e66e
94b829d
44f3229
6f0a020
a711b42
084ceae
3f6d4bd
c9a27ed
05b976c
71a0675
0a70b5f
1bee56e
d7c028d
91691de
043879f
76d7e77
ada6bf3
6b9cd15
694fe61
5a52171
9f635cd
b054536
361a2b4
1e1e9b3
006bd0b
b225cac
fafef5d
506520b
31c2e5f
4c9ae94
8acfad3
786edc7
57b373c
b25a2a1
016b352
4962131
634e95d
a2e1917
e401cf1
93296ff
72fb52d
57d5250
bb6a952
6ff0ce1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -632,6 +632,13 @@ def test_from_arrays_index_series_period(self): | |
|
||
tm.assert_index_equal(result, result2) | ||
|
||
def test_from_arrays_different_lengths(self): | ||
# GH13599 | ||
idx1 = [1, 2, 3] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add a positive example (e.g. it doesn't raise) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure if I can assert explicitly that the ValueError isn't raised. Should I simply add an example where array lengths are same and assert the response is the MultiIndex object with valid data? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you simply construct an expected MultiIndex and use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jreback is that test really required? The same input array length case is anyway getting checked in all other There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. better yet make sure to check with a 0-len array (check for all 2 cases, idx1 or idx2 is 0-len) |
||
idx2 = ['a', 'b'] | ||
assertRaisesRegexp(ValueError, '^all arrays must be same length$', | ||
MultiIndex.from_arrays, [idx1, idx2]) | ||
|
||
def test_from_product(self): | ||
|
||
first = ['foo', 'bar', 'buz'] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't -> did not
array lengths -> input array lengths