Skip to content

Split test multi #20669

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

Closed
wants to merge 7 commits into from
Closed

Conversation

xchoudhury
Copy link

@xchoudhury xchoudhury commented Apr 12, 2018

Checklist for the pandas documentation sprint (ignore this if you are doing
an unrelated PR):

  • PR title is "DOC: update the docstring"
  • The validation script passes: scripts/validate_docstrings.py <your-function-or-method>
  • The PEP8 style check passes: git diff upstream/master -u -- "*.py" | flake8 --diff
  • The html version looks good: python doc/make.py --single <your-function-or-method>
  • It has been proofread on language by another sprint participant

Please include the output of the validation script below between the "```" ticks:

# paste output of "scripts/validate_docstrings.py <your-function-or-method>" here
# between the "```" (remove this comment, but keep the "```")

If the validation script still gives errors, but you think there is a good reason
to deviate in this case (and there are certainly such cases), please state this
explicitly.

Checklist for other PRs (remove this part if you are doing a PR for the pandas documentation sprint):

@pep8speaks
Copy link

pep8speaks commented Apr 12, 2018

Hello @xchoudhury! Thanks for updating the PR.

Cheers ! There are no PEP8 issues in this Pull Request. 🍻

Comment last updated on April 13, 2018 at 05:02 Hours UTC

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls rebase. want to split slightly less, made some comments. also want to remove any unused code in each module. make sure the linter passes on this.


class TestConstructor(Base):
_holder = MultiIndex
_compat_props = ['shape', 'ndim', 'size', 'itemsize']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so things that are not used in a particular module need not be repeated here (e.g. in the constructor) and/or properties in the class.

We want to actually remove the need for the class entirely. You could do that here as well (or in a next pass PR).
This is a little trickier because need to turn things (like self.index) into fixtures. so ok with doing this later.

def create_index(self):
return self.index

def test_set_name_methods(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather these go with the names methods

self.index.labels = new_labels

def test_set_levels(self):
# side note - you probably wouldn't want to use levels and labels
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar this should go with get_levels

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see below get/set names/levels/labels can all be in 1 file

check_dtype=True)

def test_set_labels(self):
# side note - you probably wouldn't want to use levels and labels
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get/set lables/levels can be in 1 file

result = sorted_idx.slice_locs('bar', 'baz')
assert result == (2, 4)

def test_slice_locs_not_contained(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moving slice, get_loc, get_indexer into a test_indexing


import numpy as np

from pandas import (Index, MultiIndex)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be just test_sorting


def create_index(self):
return self.index

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move all of the constructors (from_product, from_array, from_tuples) into a test_constructor

self.setup_indices()

def create_index(self):
return self.index
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this with test_format

minor_labels = np.array([0, 1, 0, 1, 0, 1])
self.index_names = ['first', 'second']
self.indices = dict(index=MultiIndex(levels=[major_axis, minor_axis],
labels=[major_labels, minor_labels
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can put unique, isin, duplicates in a single file

@jreback jreback added Testing pandas testing functions or related to the test suite MultiIndex labels Apr 14, 2018
@jreback
Copy link
Contributor

jreback commented Apr 14, 2018

make sure you rebase on origin/master

@elmq0022
Copy link
Contributor

@xchoudhury I see you've done a lot of good work on splitting out the multi index tests. Would you like any help polishing this off? I'd be happy to assist.

@WillAyd WillAyd closed this Jun 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MultiIndex Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TST: split up pandas/tests/indexes/test_multi.py
5 participants