summaryrefslogtreecommitdiff
path: root/tests/test_util_inventory.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2018-01-30 00:14:53 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2018-01-30 00:14:53 +0900
commitaa47e9decce15d98c0dd4ab9ad4353b56477d81d (patch)
treec52daafead3a7cd601a2679039cb129202c20017 /tests/test_util_inventory.py
parent84551aa9c27931b0ba6d6f72797028650a074338 (diff)
downloadsphinx-git-aa47e9decce15d98c0dd4ab9ad4353b56477d81d.tar.gz
Fix #4209: intersphinx: In link title, "v" should be optional if target has no version
Diffstat (limited to 'tests/test_util_inventory.py')
-rw-r--r--tests/test_util_inventory.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_util_inventory.py b/tests/test_util_inventory.py
index 3829de9ef..3d6c9f402 100644
--- a/tests/test_util_inventory.py
+++ b/tests/test_util_inventory.py
@@ -50,6 +50,15 @@ foo.bar.qux js:data 1 index.html#foo.bar.qux -
a term including:colon std:term -1 glossary.html#term-a-term-including-colon -
'''.encode('utf-8'))
+inventory_v2_not_having_version = '''\
+# Sphinx inventory version 2
+# Project: foo
+# Version:
+# The remainder of this file is compressed with zlib.
+'''.encode('utf-8') + zlib.compress('''\
+module1 py:module 0 foo.html#module-module1 Long Module desc
+'''.encode('utf-8'))
+
def test_read_inventory_v1():
f = BytesIO(inventory_v1)
@@ -76,3 +85,10 @@ def test_read_inventory_v2():
'/util/glossary.html#term-a-term'
assert invdata['std:term']['a term including:colon'][2] == \
'/util/glossary.html#term-a-term-including-colon'
+
+
+def test_read_inventory_v2_not_having_version():
+ f = BytesIO(inventory_v2_not_having_version)
+ invdata = InventoryFile.load(f, '/util', posixpath.join)
+ assert invdata['py:module']['module1'] == \
+ ('foo', '', '/util/foo.html#module-module1', 'Long Module desc')