diff --git a/README.md b/README.md index a486a11..46edea0 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Install it: pip install displayhooks ``` -Then use it: +Then use: ```python import sys diff --git a/pyproject.toml b/pyproject.toml index 54d7934..bbb2ea3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta' [project] name = 'displayhooks' -version = '0.0.6' +version = '0.0.7' authors = [ { name='Evgeniy Blinov', email='zheni-b@yandex.ru' }, ] diff --git a/tests/test_autorestore.py b/tests/test_autorestore.py index fae79e7..de54836 100644 --- a/tests/test_autorestore.py +++ b/tests/test_autorestore.py @@ -7,6 +7,7 @@ def test_restore(): + """Restore the pre-call sys.displayhook after a decorated function changes it and returns normally.""" hook_before_declaration = sys.displayhook @autorestore_displayhook @@ -22,6 +23,7 @@ def do_something(): def test_restore_after_exception(): + """Restore the pre-call sys.displayhook and propagate an exception from a decorated function that changes it.""" hook_before_declaration = sys.displayhook @autorestore_displayhook diff --git a/tests/test_converter.py b/tests/test_converter.py index 6f11c8f..a039d10 100644 --- a/tests/test_converter.py +++ b/tests/test_converter.py @@ -19,6 +19,7 @@ ) @autorestore_displayhook def test_empty_convert(value): + """Identity converters preserve normal displayhook output for non-None values.""" @converted_displayhook def new_displayhook(value: Any) -> Any: return value @@ -34,6 +35,7 @@ def new_displayhook(value: Any) -> Any: @autorestore_displayhook def test_empty_convert_with_none(): + """An identity converter preserves sys.displayhook's no-output behavior for None.""" @converted_displayhook def new_displayhook(value: Any) -> Any: return value @@ -58,6 +60,7 @@ def new_displayhook(value: Any) -> Any: ) @autorestore_displayhook def test_elliminating_convertion(value): + """Suppress output for non-None values when the converter returns None.""" @converted_displayhook def new_displayhook(value: Any) -> Any: # noqa: ARG001 return None @@ -73,6 +76,7 @@ def new_displayhook(value: Any) -> Any: # noqa: ARG001 @autorestore_displayhook def test_elliminating_convertion_with_none(): + """Write no output when the input is None and the converter returns None.""" @converted_displayhook def new_displayhook(value: Any) -> Any: # noqa: ARG001 return None @@ -97,6 +101,7 @@ def new_displayhook(value: Any) -> Any: # noqa: ARG001 ) @autorestore_displayhook def test_real_convertion(value): + """A converted displayhook shows the converter result with normal displayhook formatting.""" @converted_displayhook def new_displayhook(value: Any) -> Any: # noqa: ARG001 return 'cheburek' diff --git a/tests/test_not_display.py b/tests/test_not_display.py index 83a46a3..ad0311c 100644 --- a/tests/test_not_display.py +++ b/tests/test_not_display.py @@ -9,6 +9,7 @@ @autorestore_displayhook def test_not_display_only_ints(): + """Suppress integer displayhook output while preserving normal string output.""" not_display(int) def display_something(something): @@ -33,6 +34,7 @@ def display_something(something): ) @autorestore_displayhook def test_not_display_ints_and_floats(some_callable): + """Suppress ints and floats for combined or separate registrations in either order while preserving string output.""" some_callable() def display_something(something):