Skip to content

Commit

Permalink
Fixing 3.6 Escape Sequence Deprecations in tests/io/parser/usecols.py (
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronCritchley authored and jreback committed Dec 23, 2017
1 parent e292a6b commit 1cd4ef0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pandas/tests/io/parser/usecols.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,16 +492,18 @@ def test_raise_on_usecols_names_mismatch(self):
tm.assert_frame_equal(df, expected)

usecols = ['a', 'b', 'c', 'f']
with tm.assert_raises_regex(ValueError, msg.format(missing="\['f'\]")):
with tm.assert_raises_regex(
ValueError, msg.format(missing=r"\['f'\]")):
self.read_csv(StringIO(data), usecols=usecols)

usecols = ['a', 'b', 'f']
with tm.assert_raises_regex(ValueError, msg.format(missing="\['f'\]")):
with tm.assert_raises_regex(
ValueError, msg.format(missing=r"\['f'\]")):
self.read_csv(StringIO(data), usecols=usecols)

usecols = ['a', 'b', 'f', 'g']
with tm.assert_raises_regex(
ValueError, msg.format(missing="\[('f', 'g'|'g', 'f')\]")):
ValueError, msg.format(missing=r"\[('f', 'g'|'g', 'f')\]")):
self.read_csv(StringIO(data), usecols=usecols)

names = ['A', 'B', 'C', 'D']
Expand All @@ -525,9 +527,11 @@ def test_raise_on_usecols_names_mismatch(self):
# tm.assert_frame_equal(df, expected)

usecols = ['A', 'B', 'C', 'f']
with tm.assert_raises_regex(ValueError, msg.format(missing="\['f'\]")):
with tm.assert_raises_regex(
ValueError, msg.format(missing=r"\['f'\]")):
self.read_csv(StringIO(data), header=0, names=names,
usecols=usecols)
usecols = ['A', 'B', 'f']
with tm.assert_raises_regex(ValueError, msg.format(missing="\['f'\]")):
with tm.assert_raises_regex(
ValueError, msg.format(missing=r"\['f'\]")):
self.read_csv(StringIO(data), names=names, usecols=usecols)

0 comments on commit 1cd4ef0

Please sign in to comment.