|
14 | 14 | import pandas.util._test_decorators as td
|
15 | 15 |
|
16 | 16 | from pandas import NaT, Timestamp
|
17 |
| -import pandas.util.testing as tm |
18 | 17 |
|
19 | 18 |
|
20 | 19 | class TestTimestampTZOperations:
|
@@ -80,44 +79,28 @@ def test_tz_localize_ambiguous(self):
|
80 | 79 | ("2015-03-29 02:30", "Europe/Belgrade"),
|
81 | 80 | ],
|
82 | 81 | )
|
83 |
| - @pytest.mark.filterwarnings("ignore::FutureWarning") |
84 | 82 | def test_tz_localize_nonexistent(self, stamp, tz):
|
85 | 83 | # GH#13057
|
86 | 84 | ts = Timestamp(stamp)
|
87 | 85 | with pytest.raises(NonExistentTimeError):
|
88 | 86 | ts.tz_localize(tz)
|
89 | 87 | # GH 22644
|
90 | 88 | with pytest.raises(NonExistentTimeError):
|
91 |
| - with tm.assert_produces_warning(FutureWarning): |
92 |
| - ts.tz_localize(tz, errors="raise") |
93 |
| - with tm.assert_produces_warning(FutureWarning): |
94 |
| - assert ts.tz_localize(tz, errors="coerce") is NaT |
| 89 | + ts.tz_localize(tz, nonexistent="raise") |
| 90 | + assert ts.tz_localize(tz, nonexistent="NaT") is NaT |
95 | 91 |
|
96 |
| - def test_tz_localize_errors_ambiguous(self): |
| 92 | + def test_tz_localize_ambiguous_raise(self): |
97 | 93 | # GH#13057
|
98 | 94 | ts = Timestamp("2015-11-1 01:00")
|
99 | 95 | with pytest.raises(AmbiguousTimeError):
|
100 |
| - with tm.assert_produces_warning(FutureWarning): |
101 |
| - ts.tz_localize("US/Pacific", errors="coerce") |
| 96 | + ts.tz_localize("US/Pacific", ambiguous="raise") |
102 | 97 |
|
103 |
| - @pytest.mark.filterwarnings("ignore::FutureWarning") |
104 |
| - def test_tz_localize_errors_invalid_arg(self): |
| 98 | + def test_tz_localize_nonexistent_invalid_arg(self): |
105 | 99 | # GH 22644
|
106 | 100 | tz = "Europe/Warsaw"
|
107 | 101 | ts = Timestamp("2015-03-29 02:00:00")
|
108 | 102 | with pytest.raises(ValueError):
|
109 |
| - with tm.assert_produces_warning(FutureWarning): |
110 |
| - ts.tz_localize(tz, errors="foo") |
111 |
| - |
112 |
| - def test_tz_localize_errors_coerce(self): |
113 |
| - # GH 22644 |
114 |
| - # make sure errors='coerce' gets mapped correctly to nonexistent |
115 |
| - tz = "Europe/Warsaw" |
116 |
| - ts = Timestamp("2015-03-29 02:00:00") |
117 |
| - with tm.assert_produces_warning(FutureWarning): |
118 |
| - result = ts.tz_localize(tz, errors="coerce") |
119 |
| - expected = ts.tz_localize(tz, nonexistent="NaT") |
120 |
| - assert result is expected |
| 103 | + ts.tz_localize(tz, nonexistent="foo") |
121 | 104 |
|
122 | 105 | @pytest.mark.parametrize(
|
123 | 106 | "stamp",
|
|
0 commit comments