diff --git a/CHANGES.rst b/CHANGES.rst index c0e82b56..18b6c213 100755 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -16,8 +16,11 @@ pending - |DOCS| `demo` page - |DOCS| `make_docs_sshots` automation script - |DOCS| `term-output`/example001-007 images +- |DOCS| `demo` page +- |DOCS| `make_docs_sshots` automation script +- |DOCS| `term-output`/example001-007 images -.. <@pending:cf41a5e> +.. <@pending:8b3da6b> .. ^ blank line before should be kept diff --git a/pytermor/template.py b/pytermor/template.py index 5c2cf8de..43fc26c7 100644 --- a/pytermor/template.py +++ b/pytermor/template.py @@ -178,7 +178,7 @@ def style(self, custom_styles: t.Dict[str, Style]) -> Style | None: return Style(base_style, **style_attrs) -class _LoggingStack(deque[_T], metaclass=ABCMeta): +class _LoggingStack(t.Deque[_T], metaclass=ABCMeta): def __init__(self, name: str, *, maxlen: int = None): super().__init__(maxlen=maxlen) self._name = name diff --git a/tests/test_common.py b/tests/test_common.py index da5e193f..4b20c9b5 100644 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -12,7 +12,7 @@ import sys from abc import ABCMeta, abstractmethod from collections import OrderedDict -from typing import Optional, Union +from typing import Optional, Union, _GenericAlias import pytest @@ -508,29 +508,35 @@ def _empty_fn(self): (staticmethod, ""), (T, "<~T>"), (t.Generic, ""), - (t.Generic[T], ""), + (t.Generic[T], ("", "_GenericAlias")), (t.Generic[T](), "Generic"), (IFilter, ""), (StringReplacer, ""), (StringReplacer("", ""), "StringReplacer"), (list[T], ""), (list[T](), "list"), - (Optional[IT], ""), - (Union[FT, None], ""), - (Union[RT, OT], ""), + (Optional[IT], ("", "_UnionGenericAlias")), + (Union[FT, None], ("", "_UnionGenericAlias")), + (Union[RT, OT], ("", "_UnionGenericAlias")), ], ids=format_test_params, ) - def test_get_qname(self, input: t.Any, expected: str): - assert get_qname(input) == expected + def test_get_qname(self, input: t.Any, expected: str | tuple[str]): + if isinstance(expected, str): + expected = [expected] + assert any(get_qname(input) == ex for ex in expected) class TestJoinCoal: - @pytest.mark.parametrize('inp, sep, exp', [ - (['a', 'b', 'c'], '', 'abc'), - (['a', 'b', 'c'], ' ', 'a b c'), - (['', '', ''], ',', ',,'), - ], ids=format_test_params) + @pytest.mark.parametrize( + "inp, sep, exp", + [ + (["a", "b", "c"], "", "abc"), + (["a", "b", "c"], " ", "a b c"), + (["", "", ""], ",", ",,"), + ], + ids=format_test_params, + ) def test_filters(self, inp, sep, exp): assert joincoal(*inp, sep=sep) == exp