From c4955e2c4f9abafd33bbe4904a82f7962333a7d6 Mon Sep 17 00:00:00 2001 From: Julien Palard Date: Fri, 11 Jun 2021 08:53:52 +0200 Subject: Doc: Prettier exception hierarchy. (GH-26533) --- Doc/library/exceptions.rst | 1 + Lib/test/exception_hierarchy.txt | 128 +++++++++++++++++++-------------------- Lib/test/test_baseexception.py | 2 +- 3 files changed, 66 insertions(+), 65 deletions(-) diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst index d5d81df..0a5037a 100644 --- a/Doc/library/exceptions.rst +++ b/Doc/library/exceptions.rst @@ -821,3 +821,4 @@ Exception hierarchy The class hierarchy for built-in exceptions is: .. literalinclude:: ../../Lib/test/exception_hierarchy.txt + :language: text diff --git a/Lib/test/exception_hierarchy.txt b/Lib/test/exception_hierarchy.txt index 6c5e821..cf54454 100644 --- a/Lib/test/exception_hierarchy.txt +++ b/Lib/test/exception_hierarchy.txt @@ -1,65 +1,65 @@ BaseException - +-- SystemExit - +-- KeyboardInterrupt - +-- GeneratorExit - +-- Exception - +-- StopIteration - +-- StopAsyncIteration - +-- ArithmeticError - | +-- FloatingPointError - | +-- OverflowError - | +-- ZeroDivisionError - +-- AssertionError - +-- AttributeError - +-- BufferError - +-- EOFError - +-- ImportError - | +-- ModuleNotFoundError - +-- LookupError - | +-- IndexError - | +-- KeyError - +-- MemoryError - +-- NameError - | +-- UnboundLocalError - +-- OSError - | +-- BlockingIOError - | +-- ChildProcessError - | +-- ConnectionError - | | +-- BrokenPipeError - | | +-- ConnectionAbortedError - | | +-- ConnectionRefusedError - | | +-- ConnectionResetError - | +-- FileExistsError - | +-- FileNotFoundError - | +-- InterruptedError - | +-- IsADirectoryError - | +-- NotADirectoryError - | +-- PermissionError - | +-- ProcessLookupError - | +-- TimeoutError - +-- ReferenceError - +-- RuntimeError - | +-- NotImplementedError - | +-- RecursionError - +-- SyntaxError - | +-- IndentationError - | +-- TabError - +-- SystemError - +-- TypeError - +-- ValueError - | +-- UnicodeError - | +-- UnicodeDecodeError - | +-- UnicodeEncodeError - | +-- UnicodeTranslateError - +-- Warning - +-- DeprecationWarning - +-- PendingDeprecationWarning - +-- RuntimeWarning - +-- SyntaxWarning - +-- UserWarning - +-- FutureWarning - +-- ImportWarning - +-- UnicodeWarning - +-- BytesWarning - +-- EncodingWarning - +-- ResourceWarning + ├── SystemExit + ├── KeyboardInterrupt + ├── GeneratorExit + └── Exception + ├── StopIteration + ├── StopAsyncIteration + ├── ArithmeticError + │ ├── FloatingPointError + │ ├── OverflowError + │ └── ZeroDivisionError + ├── AssertionError + ├── AttributeError + ├── BufferError + ├── EOFError + ├── ImportError + │ └── ModuleNotFoundError + ├── LookupError + │ ├── IndexError + │ └── KeyError + ├── MemoryError + ├── NameError + │ └── UnboundLocalError + ├── OSError + │ ├── BlockingIOError + │ ├── ChildProcessError + │ ├── ConnectionError + │ │ ├── BrokenPipeError + │ │ ├── ConnectionAbortedError + │ │ ├── ConnectionRefusedError + │ │ └── ConnectionResetError + │ ├── FileExistsError + │ ├── FileNotFoundError + │ ├── InterruptedError + │ ├── IsADirectoryError + │ ├── NotADirectoryError + │ ├── PermissionError + │ ├── ProcessLookupError + │ └── TimeoutError + ├── ReferenceError + ├── RuntimeError + │ ├── NotImplementedError + │ └── RecursionError + ├── SyntaxError + │ └── IndentationError + │ └── TabError + ├── SystemError + ├── TypeError + ├── ValueError + │ └── UnicodeError + │ ├── UnicodeDecodeError + │ ├── UnicodeEncodeError + │ └── UnicodeTranslateError + └── Warning + ├── DeprecationWarning + ├── PendingDeprecationWarning + ├── RuntimeWarning + ├── SyntaxWarning + ├── UserWarning + ├── FutureWarning + ├── ImportWarning + ├── UnicodeWarning + ├── BytesWarning + ├── EncodingWarning + └── ResourceWarning diff --git a/Lib/test/test_baseexception.py b/Lib/test/test_baseexception.py index 8db497a..0061b3f 100644 --- a/Lib/test/test_baseexception.py +++ b/Lib/test/test_baseexception.py @@ -44,7 +44,7 @@ class ExceptionClassTests(unittest.TestCase): last_depth = 0 for exc_line in inheritance_tree: exc_line = exc_line.rstrip() - depth = exc_line.rindex('-') + depth = exc_line.rindex('─') exc_name = exc_line[depth+2:] # Slice past space if '(' in exc_name: paren_index = exc_name.index('(') -- cgit v0.12