Skip to content

TST: correct constructor in extension array tests #20746

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

Conversation

jorisvandenbossche
Copy link
Member

Replace type(data)(..) with data._constructor_from_sequence.

A bit annoying the name is that long :-), but this is the correct usage.

cc @TomAugspurger

@jorisvandenbossche jorisvandenbossche added the ExtensionArray Extending pandas with custom dtypes or arrays. label Apr 19, 2018
@jorisvandenbossche jorisvandenbossche added this to the 0.23.0 milestone Apr 19, 2018
@codecov
Copy link

codecov bot commented Apr 19, 2018

Codecov Report

Merging #20746 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #20746      +/-   ##
==========================================
- Coverage   91.85%   91.84%   -0.01%     
==========================================
  Files         153      153              
  Lines       49308    49303       -5     
==========================================
- Hits        45290    45284       -6     
- Misses       4018     4019       +1
Flag Coverage Δ
#multiple 90.23% <ø> (-0.01%) ⬇️
#single 41.89% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/internals.py 95.53% <0%> (-0.05%) ⬇️
pandas/core/frame.py 97.16% <0%> (-0.01%) ⬇️
pandas/core/arrays/base.py 84.14% <0%> (ø) ⬆️
pandas/core/resample.py 96.43% <0%> (ø) ⬆️
pandas/core/indexes/datetimelike.py 96.72% <0%> (ø) ⬆️
pandas/core/indexing.py 93.08% <0%> (ø) ⬆️
pandas/core/generic.py 95.94% <0%> (ø) ⬆️
pandas/tseries/offsets.py 97% <0%> (ø) ⬆️

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 0ae7e90...88559d7. Read the comment docs.

Copy link
Contributor

@TomAugspurger TomAugspurger left a comment

Choose a reason for hiding this comment

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

Thanks.

I've grown to dislike the name _constructor_from_sequence even more in the interim. It sounds like the method is returning constructor, which would then be used to construct the array. Instead it's creating a new array from a sequence of scalars (so _from_scalars...)

Is it worth changing before it's too late?

@jreback
Copy link
Contributor

jreback commented Apr 20, 2018

why dont we rename to _from_sequence?

@jorisvandenbossche
Copy link
Member Author

I think we can certainly leave out the constructor part. For _from_scalars or _from_sequence, the doesn't indicate it is from a list/array of scalars, and the second does not indicate that it is from the dtype's scalar objects.
I personally have a preference for _from_scalars because I find the 'scalar' the more important information of the two, but _from_sequence is certainly already an improvement compared to the current name.

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Apr 20, 2018 via email

@jreback
Copy link
Contributor

jreback commented Apr 21, 2018

let's do the rename to _from_sequence in this PR (and update docs etc)

@TomAugspurger
Copy link
Contributor

The Appveyor failure was an HTTP issue. @jorisvandenbossche you can merge whenever.

@jorisvandenbossche jorisvandenbossche merged commit 31e77b0 into pandas-dev:master Apr 23, 2018
@jorisvandenbossche jorisvandenbossche deleted the extension-array-tests-from-scalars branch April 23, 2018 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ExtensionArray Extending pandas with custom dtypes or arrays.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants