Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pandas/tests/io/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ def jsonl_file(datapath):
return datapath('io', 'parser', 'data', 'items.jsonl')


@pytest.fixture
def unicode_series_file(datapath):
"""Path to unicode_series dataset"""
return datapath('io', 'data', 'unicode_series.csv')


@pytest.fixture
def salaries_table(datapath):
"""DataFrame with the salaries dataset"""
Expand Down
5 changes: 2 additions & 3 deletions pandas/tests/io/formats/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -954,9 +954,8 @@ def test_unicode_problem_decoding_as_ascii(self):
dm = DataFrame({u('c/\u03c3'): Series({'test': np.nan})})
compat.text_type(dm.to_string())

def test_string_repr_encoding(self, datapath):
filepath = datapath('io', 'formats', 'data', 'unicode_series.csv')
df = pd.read_csv(filepath, header=None, encoding='latin1')
def test_string_repr_encoding(self, unicode_series_file):
df = pd.read_csv(unicode_series_file, header=None, encoding='latin1')
repr(df)
repr(df[1])

Expand Down
7 changes: 3 additions & 4 deletions pandas/tests/io/parser/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,10 +765,9 @@ def test_utf16_example(self, datapath):
result = self.read_table(buf, encoding='utf-16')
assert len(result) == 50

def test_unicode_encoding(self, datapath):
pth = datapath('io', 'parser', 'data', 'unicode_series.csv')

result = self.read_csv(pth, header=None, encoding='latin-1')
def test_unicode_encoding(self, unicode_series_file):
result = self.read_csv(unicode_series_file,
header=None, encoding='latin-1')
result = result.set_index(0)

got = result[1][1632]
Expand Down
18 changes: 0 additions & 18 deletions pandas/tests/io/parser/data/unicode_series.csv

This file was deleted.

9 changes: 5 additions & 4 deletions pandas/tests/io/parser/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,14 @@ def test_categorical_dtype_high_cardinality_numeric(self):
np.sort(actual.a.cat.categories), ordered=True)
tm.assert_frame_equal(actual, expected)

def test_categorical_dtype_encoding(self, datapath):
def test_categorical_dtype_encoding(self, datapath, unicode_series_file):
# GH 10153
pth = datapath('io', 'parser', 'data', 'unicode_series.csv')
encoding = 'latin-1'
expected = self.read_csv(pth, header=None, encoding=encoding)
expected = self.read_csv(unicode_series_file,
header=None, encoding=encoding)
expected[1] = Categorical(expected[1])
actual = self.read_csv(pth, header=None, encoding=encoding,
actual = self.read_csv(unicode_series_file,
header=None, encoding=encoding,
dtype={1: 'category'})
tm.assert_frame_equal(actual, expected)

Expand Down