Skip to content

Commit 8c76668

Browse files
authored
Use correct role for exception links (#17)
1 parent 7cd52d5 commit 8c76668

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
dist: xenial
22
language: python
33
cache: pip
4+
branches:
5+
only:
6+
- master # use PR builder only for other branches
47
python:
58
- '3.6'
69
- '3.7'

scanpydoc/elegant_typehints/formatting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def _format_full(annotation: Type[Any], fully_qualified: bool = False):
3838
if inspect.isclass(annotation) or inspect.isclass(origin):
3939
full_name = f"{annotation.__module__}.{annotation.__qualname__}"
4040
override = elegant_typehints.qualname_overrides.get(full_name)
41-
role = "exception" if issubclass(annotation_cls, BaseException) else "class"
41+
role = "exc" if issubclass(annotation_cls, BaseException) else "class"
4242
if override is not None:
4343
return f":py:{role}:`{tilde}{override}`"
4444

tests/test_elegant_typehints.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def test_qualname_overrides_class(app):
149149

150150
def test_qualname_overrides_exception(app):
151151
assert TestExc.__module__ == "_testmod"
152-
assert _format_terse(TestExc) == ":py:exception:`~test.Excep`"
152+
assert _format_terse(TestExc) == ":py:exc:`~test.Excep`"
153153

154154

155155
def test_qualname_overrides_recursive(app):

0 commit comments

Comments
 (0)