Skip to content

Commit fd20aaf

Browse files
committed
Moved the test to the Python parser test file
1 parent 98e476e commit fd20aaf

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

pandas/io/tests/parser/python_parser_only.py

+23
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,26 @@ def test_read_table_buglet_4x_multiindex(self):
171171
columns=list('abcABC'), index=list('abc'))
172172
actual = self.read_table(StringIO(data), sep='\s+')
173173
tm.assert_frame_equal(actual, expected)
174+
175+
def test_temporary_file(self):
176+
# GH13398
177+
data1 = """index,A,B,C,D
178+
foo,2,3,4,5
179+
bar,7,8,9,10
180+
baz,12,13,14,15
181+
qux,12,13,14,15
182+
foo2,12,13,14,15
183+
bar2,12,13,14,15
184+
"""
185+
data2 = data1.replace(",", " ")
186+
187+
from tempfile import TemporaryFile
188+
new_file = TemporaryFile("w+")
189+
new_file.write(data2)
190+
new_file.flush()
191+
new_file.seek(0)
192+
193+
result = self.read_csv(new_file, sep=r"\s+", engine="python")
194+
expected = self.read_csv(StringIO(data1))
195+
tm.assert_frame_equal(result, expected)
196+

pandas/io/tests/test_common.py

-13
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class TestCommonIOCapabilities(tm.TestCase):
3333
foo2,12,13,14,15
3434
bar2,12,13,14,15
3535
"""
36-
data2 = data1.replace(",", " ")
3736

3837
def test_expand_user(self):
3938
filename = '~/sometest'
@@ -91,18 +90,6 @@ def test_iterator(self):
9190
expected.index = [0 for i in range(len(expected))]
9291
tm.assert_frame_equal(concat(it), expected.iloc[1:])
9392

94-
def test_temporary_file(self):
95-
# GH13398
96-
from tempfile import TemporaryFile
97-
new_file = TemporaryFile("w+")
98-
new_file.write(self.data2)
99-
new_file.flush()
100-
new_file.seek(0)
101-
102-
result = read_csv(new_file, sep=r"\s+", engine="python")
103-
expected = read_csv(StringIO(self.data1))
104-
tm.assert_frame_equal(result, expected)
105-
10693

10794
class TestMMapWrapper(tm.TestCase):
10895

0 commit comments

Comments
 (0)