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: allow assert_almost_equal to handle pandas instances #12247

Closed
wants to merge 1 commit into from

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented Feb 7, 2016

Closes #11584.

Because many existing tests expects assert_almost_equal to compare pandas instances, it looks better to call appropriate test functions rather than raise.

I've also fixed some failure cases caused by the change (comparing Series and list, etc).

@sinhrks sinhrks added the Testing pandas testing functions or related to the test suite label Feb 7, 2016
@sinhrks sinhrks added this to the 0.18.0 milestone Feb 7, 2016
@@ -34,7 +32,8 @@ def test_rank_tie_methods(self):

def _check(s, expected, method='average'):
result = s.rank(method=method)
assert_almost_equal(result, expected)
print(result)
tm.assert_series_equal(result, Series(expected))
Copy link
Contributor

Choose a reason for hiding this comment

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

print

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, removed.

def check_comparators(series, other, check_dtype=True):
_check_op(series, other, operator.gt, check_dtype=check_dtype)
_check_op(series, other, operator.ge, check_dtype=check_dtype)
_check_op(series, other, operator.eq, check_dtype=check_dtype)
Copy link
Contributor

Choose a reason for hiding this comment

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

were these just not being checked before?

@jreback
Copy link
Contributor

jreback commented Feb 8, 2016

just a small question

@jreback jreback closed this in b6f0292 Feb 12, 2016
@sinhrks sinhrks deleted the assert_almost branch February 27, 2016 05:39
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.

util.testing.assert_almost_equal() gives Key Error
2 participants