From c0e5b4fe4ccd1d454f9f7290128d1194d3053d28 Mon Sep 17 00:00:00 2001 From: gfyoung Date: Sun, 16 Jul 2017 08:31:12 -0700 Subject: [PATCH] TST: Add test for sub-char in read_csv (#16977) Closes gh-16893. --- pandas/tests/io/parser/common.py | 10 ++++++++++ pandas/tests/io/parser/data/sub_char.csv | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 pandas/tests/io/parser/data/sub_char.csv diff --git a/pandas/tests/io/parser/common.py b/pandas/tests/io/parser/common.py index 584a6561b505b3..4d1f9936af9833 100644 --- a/pandas/tests/io/parser/common.py +++ b/pandas/tests/io/parser/common.py @@ -1677,6 +1677,16 @@ def test_internal_eof_byte_to_file(self): result = self.read_csv(path) tm.assert_frame_equal(result, expected) + def test_sub_character(self): + # see gh-16893 + dirpath = tm.get_data_path() + filename = os.path.join(dirpath, "sub_char.csv") + + expected = DataFrame([[1, 2, 3]], columns=["a", "\x1ab", "c"]) + result = self.read_csv(filename) + + tm.assert_frame_equal(result, expected) + def test_file_handles(self): # GH 14418 - don't close user provided file handles diff --git a/pandas/tests/io/parser/data/sub_char.csv b/pandas/tests/io/parser/data/sub_char.csv new file mode 100644 index 00000000000000..ff1fa777832c73 --- /dev/null +++ b/pandas/tests/io/parser/data/sub_char.csv @@ -0,0 +1,2 @@ +a,"b",c +1,2,3 \ No newline at end of file