Skip to content

TST: Test empty method and simplify logic #15043

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 1 commit into from
Jan 4, 2017

Conversation

mroeschke
Copy link
Member

  • tests added / passed
  • passes git diff upstream/master | flake8 --diff

Since the docstring of .empty states

True if NDFrame is entirely empty [no items], meaning any of the axes are of length 0.

I was wondering if the logic could be changed accordingly for code clarity. Unless it was set as not all(len(self._get_axis(a)) > 0 for a in self._AXIS_ORDERS) for a particular reason.

Also this method did not appear to have any test.

@codecov-io
Copy link

codecov-io commented Jan 3, 2017

Current coverage is 84.75% (diff: 100%)

Merging #15043 into master will increase coverage by <.01%

@@             master     #15043   diff @@
==========================================
  Files           145        145          
  Lines         51146      51146          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          43350      43351     +1   
+ Misses         7796       7795     -1   
  Partials          0          0          

Powered by Codecov. Last update 6eb705f...9a70034

s_empty = pd.Series()
tm.assert_equal(s_empty.empty, True)

for full_series in [pd.Series([1]), pd.Series(index=[1])]:
Copy link
Contributor

Choose a reason for hiding this comment

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

look in tests/frame/test_misc_api.py (and series). prob some panel tests already.

you can add cases to there if needed

@jreback jreback added the Testing pandas testing functions or related to the test suite label Jan 3, 2017
Add test for empty method

Move tests
@mroeschke
Copy link
Member Author

Tests moved and all green.

@jorisvandenbossche jorisvandenbossche merged commit 018414e into pandas-dev:master Jan 4, 2017
@jorisvandenbossche
Copy link
Member

@thanks!

@mroeschke mroeschke deleted the alter_empty branch December 20, 2017 02:04
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.

4 participants