summaryrefslogtreecommitdiff
path: root/tests/test_intersphinx.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-08-25 12:02:59 +0000
committerGeorg Brandl <georg@python.org>2010-08-25 12:02:59 +0000
commitf1e718bbdcd150cced1ddffe1b166a23b280aebb (patch)
treebc88ca0e1c1e72a978fbb0831f6f47bc5f5c3379 /tests/test_intersphinx.py
parent0854f642623a096e39977072923d2ebe8e8a49f3 (diff)
parent1bd4ac3103fd8a4944376a766422ba4a0a7416bd (diff)
downloadsphinx-f1e718bbdcd150cced1ddffe1b166a23b280aebb.tar.gz
merge with 1.0
Diffstat (limited to 'tests/test_intersphinx.py')
-rw-r--r--tests/test_intersphinx.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/test_intersphinx.py b/tests/test_intersphinx.py
index 3b50cc78..990e35bd 100644
--- a/tests/test_intersphinx.py
+++ b/tests/test_intersphinx.py
@@ -11,7 +11,10 @@
import zlib
import posixpath
-from cStringIO import StringIO
+try:
+ from io import BytesIO
+except ImportError:
+ from cStringIO import StringIO as BytesIO
from docutils import nodes
@@ -28,23 +31,23 @@ inventory_v1 = '''\
# Version: 1.0
module mod foo.html
module.cls class foo.html
-'''
+'''.encode('utf-8')
inventory_v2 = '''\
# Sphinx inventory version 2
# Project: foo
# Version: 2.0
# The remainder of this file is compressed with zlib.
-''' + zlib.compress('''\
+'''.encode('utf-8') + zlib.compress('''\
module1 py:module 0 foo.html#module-module1 Long Module desc
module2 py:module 0 foo.html#module-$ -
module1.func py:function 1 sub/foo.html#$ -
CFunc c:function 2 cfunc.html#CFunc -
-''')
+'''.encode('utf-8'))
def test_read_inventory_v1():
- f = StringIO(inventory_v1)
+ f = BytesIO(inventory_v1)
f.readline()
invdata = read_inventory_v1(f, '/util', posixpath.join)
assert invdata['py:module']['module'] == \
@@ -54,12 +57,12 @@ def test_read_inventory_v1():
def test_read_inventory_v2():
- f = StringIO(inventory_v2)
+ f = BytesIO(inventory_v2)
f.readline()
invdata1 = read_inventory_v2(f, '/util', posixpath.join)
# try again with a small buffer size to test the chunking algorithm
- f = StringIO(inventory_v2)
+ f = BytesIO(inventory_v2)
f.readline()
invdata2 = read_inventory_v2(f, '/util', posixpath.join, bufsize=5)