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

Fixturize tests/frame/test_dtypes.py #25636

Merged
merged 7 commits into from
Jun 28, 2019

Conversation

h-vetinari
Copy link
Contributor

One more steps towards #22471. Again, needing to re-add some fixtures that were removed in #24885.

@@ -110,6 +110,18 @@ def mixed_int_frame():
return df


@pytest.fixture
def mixed_type_frame():
Copy link
Contributor

Choose a reason for hiding this comment

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

so this fixtures itself is prob ok here. as we know that this is used in many places.

Copy link
Contributor

Choose a reason for hiding this comment

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

on 2nd thought, let's see how often this is actually used, so move into the test module

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll reiterate from another thread, that with these fixturization PRs, I will:

expected = DataFrame(self.frame.values.astype(int),
index=self.frame.index,
columns=self.frame.columns)
def test_astype(self, float_frame, mixed_float_frame, mixed_type_frame):
Copy link
Contributor

Choose a reason for hiding this comment

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

see my comments elsewhere. don't use this pattern.

df['string'] = 'foo'
casted = df.astype(np.int32, errors='ignore')

expected['string'] = 'foo'
assert_frame_equal(casted, expected)

def test_astype_with_view(self):
def test_astype_with_view(self, float_frame, mixed_float_frame):
Copy link
Contributor

Choose a reason for hiding this comment

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

same

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

codecov bot commented Mar 10, 2019

Codecov Report

Merging #25636 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #25636   +/-   ##
=======================================
  Coverage   91.26%   91.26%           
=======================================
  Files         173      173           
  Lines       52968    52968           
=======================================
  Hits        48339    48339           
  Misses       4629     4629
Flag Coverage Δ
#multiple 89.83% <ø> (ø) ⬆️
#single 41.71% <ø> (ø) ⬆️

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 df771cc...5eef290. Read the comment docs.

@codecov
Copy link

codecov bot commented Mar 10, 2019

Codecov Report

Merging #25636 into master will increase coverage by 49.3%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #25636      +/-   ##
==========================================
+ Coverage   41.95%   91.26%   +49.3%     
==========================================
  Files         180      173       -7     
  Lines       50765    52982    +2217     
==========================================
+ Hits        21300    48355   +27055     
+ Misses      29465     4627   -24838
Flag Coverage Δ
#multiple 89.83% <ø> (?)
#single 41.76% <ø> (-0.2%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/compat/__init__.py 58.03% <0%> (-33.97%) ⬇️
pandas/plotting/_misc.py 38.68% <0%> (-4.56%) ⬇️
pandas/io/clipboard/clipboards.py 30.58% <0%> (-4.2%) ⬇️
pandas/core/api.py 100% <0%> (ø) ⬆️
pandas/core/groupby/__init__.py 100% <0%> (ø) ⬆️
pandas/_libs/__init__.py 100% <0%> (ø) ⬆️
pandas/io/api.py 100% <0%> (ø) ⬆️
pandas/_libs/tslibs/__init__.py 100% <0%> (ø) ⬆️
pandas/io/clipboards.py 100% <0%> (ø) ⬆️
... and 163 more

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 e9f9ca1...1321d9d. Read the comment docs.

@h-vetinari
Copy link
Contributor Author

@jreback
Split up the tests and it's green.

columns=['A', 'B']).astype('float16')
_check_cast(casted, 'float16')

def test_astype_mixed_type(self, mixed_type_frame):
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 want the repeated code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fine by me, but that means this should be done in a separate PR. I'll move the _check_cast function to the top of the module.

@@ -110,6 +110,18 @@ def mixed_int_frame():
return df


@pytest.fixture
def mixed_type_frame():
Copy link
Contributor

Choose a reason for hiding this comment

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

on 2nd thought, let's see how often this is actually used, so move into the test module

Copy link
Contributor Author

@h-vetinari h-vetinari left a comment

Choose a reason for hiding this comment

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

Same points as in the other PRs...

@@ -110,6 +110,18 @@ def mixed_int_frame():
return df


@pytest.fixture
def mixed_type_frame():
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll reiterate from another thread, that with these fixturization PRs, I will:

columns=['A', 'B']).astype('float16')
_check_cast(casted, 'float16')

def test_astype_mixed_type(self, mixed_type_frame):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fine by me, but that means this should be done in a separate PR. I'll move the _check_cast function to the top of the module.

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.

merge master

@jreback
Copy link
Contributor

jreback commented Apr 20, 2019

closing as stale

@jreback jreback closed this Apr 20, 2019
@h-vetinari
Copy link
Contributor Author

@jreback

I had merged master like you asked, this PR is not stale. Please reopen.

@h-vetinari
Copy link
Contributor Author

@jreback @gfyoung @simonjayhawkins
Can you please reopen this PR?

@h-vetinari
Copy link
Contributor Author

Thanks for reopening @simonjayhawkins.

@jreback jreback added this to the 0.25.0 milestone Jun 28, 2019
@jreback
Copy link
Contributor

jreback commented Jun 28, 2019

lgtm.

@jreback jreback merged commit 6af5840 into pandas-dev:master Jun 28, 2019
@jreback
Copy link
Contributor

jreback commented Jun 28, 2019

thanks @h-vetinari

@h-vetinari h-vetinari deleted the fixturize_frame_dtypes branch June 28, 2019 17:03
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