Skip to content

Commit 9e670a0

Browse files
[PATCH] added more doctests (- WIP #179 -)
Changes in file multicast/exceptions.py: - additional doctests added
1 parent 7350672 commit 9e670a0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

multicast/exceptions.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,23 @@ def __init__(self, message="SHUTDOWN", *args, **kwargs):
328328
>>> exc = ShutdownCommandReceived()
329329
>>> exc.exit_code == 143 # Verify SIGTERM exit code
330330
True
331+
332+
Testcase 5: Error propagation with exit_on_exception.
333+
334+
>>> @exit_on_exception
335+
... def test_func():
336+
... raise ShutdownCommandReceived()
337+
>>> test_func() # doctest: +IGNORE_EXCEPTION_DETAIL
338+
Traceback (most recent call last):
339+
SystemExit: 143
340+
341+
Testcase 6: Error message propagation.
342+
343+
>>> try:
344+
... raise ShutdownCommandReceived("Custom message")
345+
... except ShutdownCommandReceived as e:
346+
... str(e) == "Custom message"
347+
True
331348
"""
332349
if not isinstance(message, str):
333350
raise TypeError("[CWE-573] message must be a string")

0 commit comments

Comments
 (0)