Skip to content

Commit baf52dc

Browse files
committed
TST: Change method to make reporting more standard
Replaced a __init__ method with a setUp method; Makes the XML generated by nose more standard. TST: Move staticmethod to top-level Makes the XML generated by nose more standard.
1 parent d6d6339 commit baf52dc

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

pandas/io/tests/parser/test_network.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class TestCompressedUrl(object):
2424
'xz': '.xz',
2525
}
2626

27-
def __init__(self):
27+
def setUp(self):
2828
path = os.path.join(tm.get_data_path(), 'salaries.csv')
2929
self.local_table = read_table(path)
3030
self.base_url = ('https://github.com/pandas-dev/pandas/raw/master/'

pandas/tests/formats/test_format.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3938,6 +3938,15 @@ def test_period(self):
39383938
self.assertEqual(str(df), exp)
39393939

39403940

3941+
def gen_series_formatting():
3942+
s1 = pd.Series(['a'] * 100)
3943+
s2 = pd.Series(['ab'] * 100)
3944+
s3 = pd.Series(['a', 'ab', 'abc', 'abcd', 'abcde', 'abcdef'])
3945+
s4 = s3[::-1]
3946+
test_sers = {'onel': s1, 'twol': s2, 'asc': s3, 'desc': s4}
3947+
return test_sers
3948+
3949+
39413950
class TestSeriesFormatting(tm.TestCase):
39423951

39433952
def setUp(self):
@@ -4335,15 +4344,6 @@ def test_consistent_format(self):
43354344
'1.0000\n129 1.0000\ndtype: float64')
43364345
self.assertEqual(res, exp)
43374346

4338-
@staticmethod
4339-
def gen_test_series():
4340-
s1 = pd.Series(['a'] * 100)
4341-
s2 = pd.Series(['ab'] * 100)
4342-
s3 = pd.Series(['a', 'ab', 'abc', 'abcd', 'abcde', 'abcdef'])
4343-
s4 = s3[::-1]
4344-
test_sers = {'onel': s1, 'twol': s2, 'asc': s3, 'desc': s4}
4345-
return test_sers
4346-
43474347
def chck_ncols(self, s):
43484348
with option_context("display.max_rows", 10):
43494349
res = repr(s)
@@ -4354,7 +4354,7 @@ def chck_ncols(self, s):
43544354
self.assertEqual(ncolsizes, 1)
43554355

43564356
def test_format_explicit(self):
4357-
test_sers = self.gen_test_series()
4357+
test_sers = gen_series_formatting()
43584358
with option_context("display.max_rows", 4):
43594359
res = repr(test_sers['onel'])
43604360
exp = '0 a\n1 a\n ..\n98 a\n99 a\ndtype: object'
@@ -4373,7 +4373,7 @@ def test_format_explicit(self):
43734373
self.assertEqual(exp, res)
43744374

43754375
def test_ncols(self):
4376-
test_sers = self.gen_test_series()
4376+
test_sers = gen_series_formatting()
43774377
for s in test_sers.values():
43784378
self.chck_ncols(s)
43794379

0 commit comments

Comments
 (0)