Skip to content

TST: Adding unit tests for named indexes resulting from empty datafra… #43593

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

Merged
merged 9 commits into from
Oct 31, 2021

Conversation

IamJasonBian
Copy link
Contributor

@IamJasonBian IamJasonBian commented Sep 16, 2021

…me shifts

Tests added for issue: #41264

@pep8speaks
Copy link

pep8speaks commented Sep 16, 2021

Hello @IamJasonBian! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-10-31 04:18:30 UTC

import numpy as np
import pytest

from pandas import (
Copy link
Contributor

Choose a reason for hiding this comment

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

pls don't make a new file, look for a similar test in this directory and put it near.


import pandas._testing as tm

def test_empty_shift_with_fill():
Copy link
Contributor

Choose a reason for hiding this comment

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

referencde the original issue in a comment


tm.assert_frame_equal(shifted, shifted_with_fill)
tm.assert_index_equal(shifted.index, shifted_with_fill.index)

Copy link
Contributor

Choose a reason for hiding this comment

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

looks like you can parameterize some of these

@jreback jreback added Index Related to the Index class or subclasses Testing pandas testing functions or related to the test suite labels Sep 18, 2021
@IamJasonBian
Copy link
Contributor Author

@jreback

  • merged with test_groupby_shift_diff
  • removed third test as issue did not exist in 1.3.0.dev0+1510.gfea6799dba

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 merge master and ping on green

@@ -113,3 +113,33 @@ def test_group_diff_object_raises(object_dtype):
)
with pytest.raises(TypeError, match=r"unsupported operand type\(s\) for -"):
df.groupby("a")["b"].diff()

@pytest.mark.parametrize(
Copy link
Contributor

Choose a reason for hiding this comment

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

since this is just a single test no need to parameterize (e.g. just create it inside the test)

@jreback jreback added this to the 1.4 milestone Oct 3, 2021
@jreback jreback added the Groupby label Oct 3, 2021
@IamJasonBian
Copy link
Contributor Author

@jreback, ok to push? Not sure why pre-commit black is failing and PEP8 linter passed locally.

@jreback
Copy link
Contributor

jreback commented Oct 5, 2021

no if precommit is failing then there is a problem

@IamJasonBian
Copy link
Contributor Author

@jreback pinging on green

@mroeschke
Copy link
Member

@IamJasonBian could you merge master one more time? Will merge after all green again

@jreback jreback merged commit eb00c22 into pandas-dev:master Oct 31, 2021
@jreback
Copy link
Contributor

jreback commented Oct 31, 2021

thanks @IamJasonBian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Groupby Index Related to the Index class or subclasses Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: specifying fill_value in pandas.DataFrame.shift() messes with index of empty dataframes
4 participants