From b029d52ce53a9970d4d50a8bbd39cc17160192ad Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 15 Sep 2015 21:50:31 -0400 Subject: [PATCH] BF: do not assume that expanduser would replace all ~ since it must not e.g. if there is ~ in some directory name along the path. Better to check either new path is absolute. Removed test had no value --- pandas/io/tests/test_common.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/io/tests/test_common.py b/pandas/io/tests/test_common.py index 34e7c94b64bcb..03d1e4fb1f365 100644 --- a/pandas/io/tests/test_common.py +++ b/pandas/io/tests/test_common.py @@ -3,6 +3,7 @@ """ from pandas.compat import StringIO import os +from os.path import isabs import pandas.util.testing as tm @@ -16,7 +17,7 @@ def test_expand_user(self): expanded_name = common._expand_user(filename) self.assertNotEqual(expanded_name, filename) - self.assertNotIn('~', expanded_name) + self.assertTrue(isabs(expanded_name)) self.assertEqual(os.path.expanduser(filename), expanded_name) def test_expand_user_normal_path(self): @@ -24,14 +25,13 @@ def test_expand_user_normal_path(self): expanded_name = common._expand_user(filename) self.assertEqual(expanded_name, filename) - self.assertNotIn('~', expanded_name) self.assertEqual(os.path.expanduser(filename), expanded_name) def test_get_filepath_or_buffer_with_path(self): filename = '~/sometest' filepath_or_buffer, _, _ = common.get_filepath_or_buffer(filename) self.assertNotEqual(filepath_or_buffer, filename) - self.assertNotIn('~', filepath_or_buffer) + self.assertTrue(isabs(filepath_or_buffer)) self.assertEqual(os.path.expanduser(filename), filepath_or_buffer) def test_get_filepath_or_buffer_with_buffer(self):