-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Catch Exception in combine #22936
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
Catch Exception in combine #22936
Changes from 4 commits
fdd43c4
ce94bf9
0c53f08
9059c0d
85fc5d8
2183f7b
0eef0cf
be63feb
a4a2933
b9c7e4b
ce1a3c6
5372134
01f7366
1921c6f
7714e79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from .array import DecimalArray, DecimalDtype | ||
|
||
|
||
__all__ = ['DecimalArray', 'DecimalDtype'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add here make_data ? (that are typically the ones that I use to test things out locally) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .array import JSONArray, JSONDtype | ||
|
||
__all__ = ['JSONArray', 'JSONDtype'] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import operator | ||
from decimal import Decimal | ||
|
||
import pandas as pd | ||
import pandas.util.testing as tm | ||
from pandas.tests.extension.decimal_array import DecimalArray | ||
|
||
|
||
def test_combine_from_sequence_raises(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this not with the existomg tests? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't a base extensionarray test that applies to all EAs. It's just to EAs that may raise errors other than TypeError in We need a place for simple tests like this that
This seemed like a sensible home. |
||
# https://github.com/pandas-dev/pandas/issues/22850 | ||
class BadDecimalArray(DecimalArray): | ||
def _from_sequence(cls, scalars, dtype=None, copy=False): | ||
raise KeyError("For the test") | ||
|
||
ser = pd.Series(BadDecimalArray([Decimal("1.0"), Decimal("2.0")])) | ||
result = ser.combine(ser, operator.add) | ||
|
||
# note: object dtype | ||
expected = pd.Series([Decimal("2.0"), Decimal("4.0")], dtype="object") | ||
tm.assert_series_equal(result, expected) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not clear what is changing here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#22936 (comment)