Skip to content

Commit 6e76b51

Browse files
committed
test for warning
1 parent ace62aa commit 6e76b51

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

pandas/core/internals/blocks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1960,7 +1960,7 @@ def formatting_values(self):
19601960
"'ExtensionArray._formatting_values' is deprecated. "
19611961
"Specify 'ExtensionArray._formatter' instead."
19621962
)
1963-
warnings.warn(msg, FutureWarning)
1963+
warnings.warn(msg, FutureWarning, stacklevel=10)
19641964
return self.values._formatting_values()
19651965

19661966
# the future implementation (and current, if not overrode)

pandas/tests/extension/decimal/test_decimal.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ class TestSetitem(BaseDecimal, base.BaseSetitemTests):
202202

203203

204204
class TestPrinting(BaseDecimal, base.BasePrintingTests):
205-
pass
205+
pytestmark = pytest.mark.skipif(compat.PY2,
206+
reason="Unhashble dtype in Py2.")
206207

207208

208209
# TODO(extension)
@@ -384,3 +385,14 @@ def test_divmod_array(reverse, expected_div, expected_mod):
384385

385386
tm.assert_extension_array_equal(div, expected_div)
386387
tm.assert_extension_array_equal(mod, expected_mod)
388+
389+
390+
def test_formatting_values_deprecated():
391+
class DecimalArray2(DecimalArray):
392+
def _formatting_values(self):
393+
return np.array(self)
394+
395+
ser = pd.Series(DecimalArray2([decimal.Decimal('1.0')]))
396+
397+
with tm.assert_produces_warning(FutureWarning):
398+
repr(ser)

0 commit comments

Comments
 (0)