Skip to content

Commit bf477dc

Browse files
author
y-p
committed
Merge pull request #6110 from y-p/PR_test_cleanups
CLN: Eliminate handful of test docstrings, use nose -v on travis
2 parents c059639 + 962e436 commit bf477dc

11 files changed

+21
-31
lines changed

CONTRIBUTING.md

+2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ looking for a quick way to help out.
6363
- Add deprecation warnings where needed.
6464
- Performance matters. Make sure your PR hasn't introduced perf regressions by using `test_perf.sh`.
6565
- Docstrings follow the [numpydoc](https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt) format.
66+
- Write tests.
6667
- When writing tests, use 2.6 compatible `self.assertFoo` methods. Some polyfills such as `assertRaises`
6768
can be found in `pandas.util.testing`.
69+
- Do not attach doctrings to tests. Make the test itself readable and use comments if needed.
6870
- Generally, pandas source files should not contain attributions. You can include a "thanks to..."
6971
in the release changelog. The rest is `git blame`/`git log`.
7072
- When you start working on a PR, start by creating a new branch pointing at the latest

ci/script.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ if [ -n "$LOCALE_OVERRIDE" ]; then
99
python -c "$pycmd"
1010
fi
1111

12-
echo nosetests --exe -w /tmp -A "$NOSE_ARGS" pandas --with-xunit --xunit-file=/tmp/nosetests.xml
13-
nosetests --exe -w /tmp -A "$NOSE_ARGS" pandas --with-xunit --xunit-file=/tmp/nosetests.xml
12+
echo nosetests -v --exe -w /tmp -A "$NOSE_ARGS" pandas --with-xunit --xunit-file=/tmp/nosetests.xml
13+
nosetests -v --exe -w /tmp -A "$NOSE_ARGS" pandas --with-xunit --xunit-file=/tmp/nosetests.xml

pandas/io/tests/test_data.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,7 @@ def test_get_components_dax(self):
168168

169169
@network
170170
def test_get_components_nasdaq_100(self):
171-
"""as of 7/12/13 the conditional will test false because the link is
172-
invalid"""
171+
# as of 7/12/13 the conditional will test false because the link is invalid
173172
raise nose.SkipTest('unreliable test, receive partial components back for nasdaq_100')
174173

175174
df = web.get_components_yahoo('^NDX') #NASDAQ-100

pandas/io/tests/test_pytables.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3201,7 +3201,7 @@ def test_frame_select(self):
32013201
# 'frame', [crit1, crit2])
32023202

32033203
def test_frame_select_complex(self):
3204-
""" select via complex criteria """
3204+
# select via complex criteria
32053205

32063206
df = tm.makeTimeDataFrame()
32073207
df['string'] = 'foo'

pandas/io/tests/test_sql.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,9 @@ def test_keyword_as_column_names(self):
226226
sql.write_frame(df, con = self.db, name = 'testkeywords')
227227

228228
def test_onecolumn_of_integer(self):
229-
'''
230-
GH 3628
231-
a column_of_integers dataframe should transfer well to sql
232-
'''
229+
# GH 3628
230+
# a column_of_integers dataframe should transfer well to sql
231+
233232
mono_df=DataFrame([1 , 2], columns=['c0'])
234233
sql.write_frame(mono_df, con = self.db, name = 'mono_df')
235234
# computing the sum via sql

pandas/tests/test_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def test_deprecate_option(self):
250250

251251
# testing warning with catch_warning was only added in 2.6
252252
if sys.version_info[:2] < (2, 6):
253-
raise nose.SkipTest()
253+
raise nose.SkipTest("Need py > 2.6")
254254

255255
self.assertTrue(self.cf._is_deprecated('foo'))
256256
with warnings.catch_warnings(record=True) as w:

pandas/tests/test_frame.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -2599,11 +2599,9 @@ def test_constructor_maskedarray_nonfloat(self):
25992599
self.assertEqual(False, frame['C'][2])
26002600

26012601
def test_constructor_mrecarray(self):
2602-
"""
2603-
Ensure mrecarray produces frame identical to dict of masked arrays
2604-
from GH3479
2602+
# Ensure mrecarray produces frame identical to dict of masked arrays
2603+
# from GH3479
26052604

2606-
"""
26072605
assert_fr_equal = functools.partial(assert_frame_equal,
26082606
check_index_type=True,
26092607
check_column_type=True,
@@ -11648,10 +11646,8 @@ def test_consolidate_datetime64(self):
1164811646
assert_array_equal(df.ending.values, ser_ending.index.values)
1164911647

1165011648
def test_tslib_tz_convert_trans_pos_plus_1__bug(self):
11651-
"""
11652-
Regression test for tslib.tz_convert(vals, tz1, tz2).
11653-
See https://github.com/pydata/pandas/issues/4496 for details.
11654-
"""
11649+
# Regression test for tslib.tz_convert(vals, tz1, tz2).
11650+
# See https://github.com/pydata/pandas/issues/4496 for details.
1165511651
idx = pd.date_range(datetime(2011, 3, 26, 23), datetime(2011, 3, 27, 1), freq='1min')
1165611652
idx = idx.tz_localize('UTC')
1165711653
idx = idx.tz_convert('Europe/Moscow')

pandas/tests/test_indexing.py

-2
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,6 @@ def test_loc_setitem_frame(self):
647647
assert_frame_equal(result, expected)
648648

649649
def test_iloc_getitem_frame(self):
650-
""" originally from test_frame.py"""
651650
df = DataFrame(np.random.randn(10, 4), index=lrange(0, 20, 2), columns=lrange(0,8,2))
652651

653652
result = df.iloc[2]
@@ -793,7 +792,6 @@ def f():
793792
self.assertRaises(ValueError, f)
794793

795794
def test_iloc_setitem_series(self):
796-
""" originally from test_series.py """
797795
df = DataFrame(np.random.randn(10, 4), index=list('abcdefghij'), columns=list('ABCD'))
798796

799797
df.iloc[1,1] = 1

pandas/tests/test_series.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -1677,14 +1677,12 @@ def test_repr_name_iterable_indexable(self):
16771677
repr(s)
16781678

16791679
def test_repr_should_return_str(self):
1680-
"""
1681-
http://docs.python.org/py3k/reference/datamodel.html#object.__repr__
1682-
http://docs.python.org/reference/datamodel.html#object.__repr__
1683-
"...The return value must be a string object."
1680+
# http://docs.python.org/py3k/reference/datamodel.html#object.__repr__
1681+
# http://docs.python.org/reference/datamodel.html#object.__repr__
1682+
# ...The return value must be a string object.
16841683

1685-
(str on py2.x, str (unicode) on py3)
1684+
# (str on py2.x, str (unicode) on py3)
16861685

1687-
"""
16881686
data = [8, 5, 3, 5]
16891687
index1 = [u("\u03c3"), u("\u03c4"), u("\u03c5"), u("\u03c6")]
16901688
df = Series(data, index=index1)

pandas/tseries/tests/test_resample.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ def test_all_values_single_bin(self):
10451045
tm.assert_almost_equal(result[0], s.mean())
10461046

10471047
def test_resample_doesnt_truncate(self):
1048-
"""Test for issue #3020"""
1048+
# Test for issue #3020
10491049
import pandas as pd
10501050
dates = pd.date_range('01-Jan-2014','05-Jan-2014', freq='D')
10511051
series = Series(1, index=dates)

pandas/tseries/tests/test_timezones.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,8 @@ def test_timestamp_tz_localize(self):
105105
self.assertEquals(result, expected)
106106

107107
def test_timestamp_constructed_by_date_and_tz(self):
108-
"""
109-
Fix Issue 2993, Timestamp cannot be constructed by datetime.date
110-
and tz correctly
111-
"""
108+
# Fix Issue 2993, Timestamp cannot be constructed by datetime.date
109+
# and tz correctly
112110

113111
result = Timestamp(date(2012, 3, 11), tz='US/Eastern')
114112

0 commit comments

Comments
 (0)