Skip to content

Commit

Permalink
🧪 TESTS: 'fix for python 3.9`
Browse files Browse the repository at this point in the history
  • Loading branch information
delameter committed Dec 3, 2023
1 parent 8b3da6b commit 3f9208a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
5 changes: 4 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pytermor/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 18 additions & 12 deletions tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -508,29 +508,35 @@ def _empty_fn(self):
(staticmethod, "<staticmethod>"),
(T, "<~T>"),
(t.Generic, "<Generic>"),
(t.Generic[T], "<typing.Generic[~T]>"),
(t.Generic[T], ("<typing.Generic[~T]>", "_GenericAlias")),
(t.Generic[T](), "Generic"),
(IFilter, "<IFilter>"),
(StringReplacer, "<StringReplacer>"),
(StringReplacer("", ""), "StringReplacer"),
(list[T], "<list>"),
(list[T](), "list"),
(Optional[IT], "<typing.Optional[~IT]>"),
(Union[FT, None], "<typing.Optional[~FT]>"),
(Union[RT, OT], "<typing.Union[~RT, ~OT]>"),
(Optional[IT], ("<typing.Optional[~IT]>", "_UnionGenericAlias")),
(Union[FT, None], ("<typing.Optional[~FT]>", "_UnionGenericAlias")),
(Union[RT, OT], ("<typing.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

Expand Down

0 comments on commit 3f9208a

Please sign in to comment.