-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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
TST: adding join_types fixture #20287
Conversation
Hello @almaleksia! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on March 12, 2018 at 23:23 Hours UTC |
pandas/conftest.py
Outdated
JOIN_TYPES = ['inner', 'outer', 'left', 'right'] | ||
|
||
|
||
# workaround for parametrized tests |
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.
why is this a work-around?
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.
can you give a nice doc-string to this, it shows up when we list fixtures
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.
@jreback Sure.
Workaround because I cannot use join_types fixture in parametrize, there is a proposal for this in pytest but still not implemented. I will remove it to avoid confusion :)
@@ -297,7 +297,7 @@ def test_join_on_series_buglet(self): | |||
'b': [2, 2]}, index=df.index) | |||
tm.assert_frame_equal(result, expected) | |||
|
|||
def test_join_index_mixed(self): | |||
def test_join_index_mixed(self, join_types): |
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.
so I would still parameterize this with join_type (not the plural)
pandas/conftest.py
Outdated
return request.param | ||
|
||
|
||
@pytest.fixture(scope='module') |
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.
I don't really want to have 2 fixtures like this, just join_type is fine.
fe4c283
to
e28a2e9
Compare
Codecov Report
@@ Coverage Diff @@
## master #20287 +/- ##
=========================================
Coverage ? 91.73%
=========================================
Files ? 150
Lines ? 49168
Branches ? 0
=========================================
Hits ? 45102
Misses ? 4066
Partials ? 0
Continue to review full report at Codecov.
|
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.
looks really good! just some minor whitespace / lint things. ping on green.
pandas/tests/indexes/test_multi.py
Outdated
@@ -2829,7 +2823,7 @@ def test_remove_unused_nan(self, level0, level1): | |||
result = mi.remove_unused_levels() | |||
tm.assert_index_equal(result, mi) | |||
for level in 0, 1: | |||
assert('unused' not in result.levels[level]) | |||
assert ('unused' not in result.levels[level]) |
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.
can you remove this paren
pandas/tests/indexes/test_multi.py
Outdated
@@ -2435,7 +2429,7 @@ def check(nlevels, with_nulls): | |||
def test_duplicate_meta_data(self): | |||
# GH 10115 | |||
index = MultiIndex(levels=[[0, 1], [0, 1, 2]], labels=[ | |||
[0, 0, 0, 0, 1, 1, 1], [0, 1, 2, 0, 0, 1, 2]]) |
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.
put labels on the next line then this will line up better
@@ -431,11 +424,11 @@ def test_merge_nosort(self): | |||
"var2": np.random.randint(0, 10, size=10), | |||
"var3": [datetime(2012, 1, 12), datetime(2011, 2, 4), | |||
datetime( |
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.
you can put all of the datetime on separate lines to avoid this kind of splitting
e28a2e9
to
1107309
Compare
1107309
to
9dabfc1
Compare
thanks @almaleksia keep em coming! if you are looking for things........want to make tz a top-level fixture (prob need to name it something different though as the name tz is pretty common), e.g. https://github.com/pandas-dev/pandas/blob/master/pandas/tests/indexes/datetimes/test_timezones.py#L244 (and many other very similar lines of code). |
@jreback sure, thank you for the feedback. I'll make PR. I also wanted to take splitting pandas/tests/frame/test_indexing.py :D |
follow up for PR #20059
Extracting join types to a fixture
git diff upstream/master -u -- "*.py" | flake8 --diff