Skip to content
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

Merged
merged 1 commit into from
Mar 13, 2018

Conversation

almaleksia
Copy link
Contributor

follow up for PR #20059

Extracting join types to a fixture

  • tests added / passed
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff

@pep8speaks
Copy link

pep8speaks commented Mar 11, 2018

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

JOIN_TYPES = ['inner', 'outer', 'left', 'right']


# workaround for parametrized tests
Copy link
Contributor

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?

Copy link
Contributor

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

Copy link
Contributor Author

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):
Copy link
Contributor

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)

return request.param


@pytest.fixture(scope='module')
Copy link
Contributor

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.

@jreback jreback added the Testing pandas testing functions or related to the test suite label Mar 11, 2018
@codecov
Copy link

codecov bot commented Mar 11, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@31afaf8). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #20287   +/-   ##
=========================================
  Coverage          ?   91.73%           
=========================================
  Files             ?      150           
  Lines             ?    49168           
  Branches          ?        0           
=========================================
  Hits              ?    45102           
  Misses            ?     4066           
  Partials          ?        0
Flag Coverage Δ
#multiple 90.11% <ø> (?)
#single 41.86% <ø> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 31afaf8...9dabfc1. Read the comment docs.

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.

looks really good! just some minor whitespace / lint things. ping on green.

@@ -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])
Copy link
Contributor

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

@@ -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]])
Copy link
Contributor

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(
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 all of the datetime on separate lines to avoid this kind of splitting

@jreback jreback added this to the 0.23.0 milestone Mar 12, 2018
@jreback jreback merged commit 69c079f into pandas-dev:master Mar 13, 2018
@jreback
Copy link
Contributor

jreback commented Mar 13, 2018

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).

@almaleksia
Copy link
Contributor Author

@jreback sure, thank you for the feedback. I'll make PR. I also wanted to take splitting pandas/tests/frame/test_indexing.py :D

@almaleksia almaleksia mentioned this pull request Mar 15, 2018
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants