From be63feb818b1e39d0f711d55c1eac809a03ee061 Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Tue, 2 Oct 2018 11:19:17 -0500 Subject: [PATCH] move test --- .../decimal/decimal_array/test_decimal.py | 17 ++++++++++++++++ pandas/tests/extension/test_ops.py | 20 ------------------- 2 files changed, 17 insertions(+), 20 deletions(-) delete mode 100644 pandas/tests/extension/test_ops.py diff --git a/pandas/tests/extension/decimal/decimal_array/test_decimal.py b/pandas/tests/extension/decimal/decimal_array/test_decimal.py index 93b8ea786ef5b..c7a39ce3ff9f5 100644 --- a/pandas/tests/extension/decimal/decimal_array/test_decimal.py +++ b/pandas/tests/extension/decimal/decimal_array/test_decimal.py @@ -1,3 +1,4 @@ +import operator import decimal import random @@ -275,3 +276,19 @@ def test_compare_array(self, data, all_compare_operators): other = pd.Series(data) * [decimal.Decimal(pow(2.0, i)) for i in alter] self._compare_other(s, data, op_name, other) + + +def test_combine_from_sequence_raises(): + # 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.Decimal("1.0"), + decimal.Decimal("2.0")])) + result = ser.combine(ser, operator.add) + + # note: object dtype + expected = pd.Series([decimal.Decimal("2.0"), + decimal.Decimal("4.0")], dtype="object") + tm.assert_series_equal(result, expected) diff --git a/pandas/tests/extension/test_ops.py b/pandas/tests/extension/test_ops.py deleted file mode 100644 index bf2c23b58b6b6..0000000000000 --- a/pandas/tests/extension/test_ops.py +++ /dev/null @@ -1,20 +0,0 @@ -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(): - # 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)