Skip to content
Snippets Groups Projects
Commit dd982ef9 authored by Simon Sebastian Humpohl's avatar Simon Sebastian Humpohl
Browse files

Fix examples and doctest outputs

parent fb75c18f
Branches
Tags v1.23.0
1 merge request!78Fix examples and doctest outputs
......@@ -72,11 +72,11 @@ def argmax(it: Iterable) -> int:
def ignore_exceptions(it: Iterable, exceptions: Any) -> Iterator:
"""Ignore all specified exceptions during iteration.
>>> list(filter_exceptions(map(lambda d: 5 / d, [2, 1, 0, 5]), ZeroDivisionError))
>>> list(ignore_exceptions(map(lambda d: 5 / d, [2, 1, 0, 5]), ZeroDivisionError))
[2.5, 5.0, 1.0]
Be aware that some iterators do not allow further iteration if they threw an exception.
>>> list(filter_exceptions((5 / d for d in [2, 1, 0, 5]), ZeroDivisionError))
>>> list(ignore_exceptions((5 / d for d in [2, 1, 0, 5]), ZeroDivisionError))
[2.5, 5.0]
Parameters
......
......@@ -24,7 +24,8 @@ Plot data using a style adjusted to APS journals:
>>> with plt.style.context('qutil.plotting.publication_aps_tex'):
... plt.plot([1, 2], [3, 4], label='presentation style')
... plt.legend()
... plt.show()
... plt.show(block=False)
[...
Plot data using all available custom styles:
......@@ -36,7 +37,7 @@ Plot data using all available custom styles:
... with plt.style.context(style):
... plt.plot([1, 2], [3, 4])
... plt.title(file.stem)
... plt.show()
... plt.show(block=False)
[...
"""
from .core import *
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment