Skip to content

BF: do not assume that expanduser would replace all ~ #11120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 17, 2015
Merged
Changes from all commits
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: 3 additions & 3 deletions pandas/io/tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
from pandas.compat import StringIO
import os
from os.path import isabs

import pandas.util.testing as tm

Expand All @@ -16,22 +17,21 @@ 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):
filename = '/somefolder/sometest'
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):
Expand Down