Skip to content

Commit 66c72ae

Browse files
jrebackNo-Stream
authored andcommitted
TST: remove some warnings (pandas-dev#17638)
1 parent 3dcb032 commit 66c72ae

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

pandas/core/reshape/reshape.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ def lreshape(data, groups, dropna=True, label=None):
851851
return DataFrame(mdata, columns=id_cols + pivot_cols)
852852

853853

854-
def wide_to_long(df, stubnames, i, j, sep="", suffix='\d+'):
854+
def wide_to_long(df, stubnames, i, j, sep="", suffix=r'\d+'):
855855
r"""
856856
Wide panel to long format. Less flexible but more user-friendly than melt.
857857

pandas/plotting/_core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2726,7 +2726,7 @@ def barh(self, x=None, y=None, **kwds):
27262726
return self(kind='barh', x=x, y=y, **kwds)
27272727

27282728
def box(self, by=None, **kwds):
2729-
"""
2729+
r"""
27302730
Boxplot
27312731
27322732
.. versionadded:: 0.17.0

pandas/tests/frame/test_operators.py

+6
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,12 @@ def test_boolean_comparison(self):
10351035
result = df == tup
10361036
assert_frame_equal(result, expected)
10371037

1038+
def test_boolean_comparison_error(self):
1039+
1040+
# GH 4576
1041+
# boolean comparisons with a tuple/list give unexpected results
1042+
df = DataFrame(np.arange(6).reshape((3, 2)))
1043+
10381044
# not shape compatible
10391045
pytest.raises(ValueError, lambda: df == (2, 2))
10401046
pytest.raises(ValueError, lambda: df == [2, 2])

pandas/tests/indexes/test_interval.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ def test_errors(self):
10681068
interval_range(start='foo', periods=10)
10691069

10701070
# invalid end
1071-
msg = 'end must be numeric or datetime-like, got \(0, 1\]'
1071+
msg = r'end must be numeric or datetime-like, got \(0, 1\]'
10721072
with tm.assert_raises_regex(ValueError, msg):
10731073
interval_range(end=Interval(0, 1), periods=10)
10741074

pandas/tests/io/test_stata.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,8 @@ def test_iterator(self):
10531053
tm.assert_frame_equal(parsed.iloc[0:5, :], chunk)
10541054

10551055
# GH12153
1056-
from_chunks = pd.concat(read_stata(fname, chunksize=4))
1056+
with read_stata(fname, chunksize=4) as itr:
1057+
from_chunks = pd.concat(itr)
10571058
tm.assert_frame_equal(parsed, from_chunks)
10581059

10591060
def test_read_chunks_115(self):
@@ -1306,8 +1307,9 @@ def test_value_labels_iterator(self, write_index):
13061307
df['A'] = df['A'].astype('category')
13071308
with tm.ensure_clean() as path:
13081309
df.to_stata(path, write_index=write_index)
1309-
dta_iter = pd.read_stata(path, iterator=True)
1310-
value_labels = dta_iter.value_labels()
1310+
1311+
with pd.read_stata(path, iterator=True) as dta_iter:
1312+
value_labels = dta_iter.value_labels()
13111313
assert value_labels == {'A': {0: 'A', 1: 'B', 2: 'C', 3: 'E'}}
13121314

13131315
def test_set_index(self):

0 commit comments

Comments
 (0)