summaryrefslogtreecommitdiff
path: root/tests/path.py
diff options
context:
space:
mode:
authorTakayuki Shimizukawa <shimizukawa@gmail.com>2012-05-01 15:13:06 +0900
committerTakayuki Shimizukawa <shimizukawa@gmail.com>2012-05-01 15:13:06 +0900
commit1bb4923da1aa1878af44c4608d63025e4fae9d3b (patch)
tree555db29968bd2f149c3d04ddd90aba0fc7705fdb /tests/path.py
parent9af2094ca44265c892d59792156db4950475b18b (diff)
downloadsphinx-git-1bb4923da1aa1878af44c4608d63025e4fae9d3b.tar.gz
support multibyte filename handling.
https://bitbucket.org/birkenfeld/sphinx/issue/703
Diffstat (limited to 'tests/path.py')
-rw-r--r--tests/path.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/path.py b/tests/path.py
index 8e9afeaa8..bd0552d70 100644
--- a/tests/path.py
+++ b/tests/path.py
@@ -16,16 +16,16 @@ from codecs import open
FILESYSTEMENCODING = sys.getfilesystemencoding() or sys.getdefaultencoding()
-class path(str):
+class path(unicode):
"""
Represents a path which behaves like a string.
"""
if sys.version_info < (3, 0):
def __new__(cls, s, encoding=FILESYSTEMENCODING, errors='strict'):
- if isinstance(s, unicode):
- s = s.encode(encoding, errors=errors)
- return str.__new__(cls, s)
- return str.__new__(cls, s)
+ if isinstance(s, str):
+ s = s.decode(encoding, errors)
+ return unicode.__new__(cls, s)
+ return unicode.__new__(cls, s)
@property
def parent(self):
@@ -193,4 +193,4 @@ class path(str):
__div__ = __truediv__ = joinpath
def __repr__(self):
- return '%s(%s)' % (self.__class__.__name__, str.__repr__(self))
+ return '%s(%s)' % (self.__class__.__name__, unicode.__repr__(self))