Skip to content

Commit cb52dd2

Browse files
fix(typing): put EllipsisType in LengthType union (#116)
``` tests/integration_python/test_main_cli.py:1481: error: No overload variant of "IsList" matches argument type "EllipsisType" [call-overload] tests/integration_python/test_main_cli.py:1481: note: Possible overload variants: tests/integration_python/test_main_cli.py:1481: note: def IsList(self, *items: Any, check_order: bool = ..., length: int | tuple[int, int | Any] | None = ...) -> IsList tests/integration_python/test_main_cli.py:1481: note: def IsList(self, positions: dict[int, Any], length: int | tuple[int, int | Any] | None = ...) -> IsList ``` An ellipsis is a valid argument, as shown in the docs: https://dirty-equals.helpmanual.io/latest/types/sequence/?h=isl#dirty_equals.IsList. closes gh-110 --------- Co-authored-by: Francesco Bruzzesi <42817048+FBruzzesi@users.noreply.github.com>
1 parent 31ab5a3 commit cb52dd2

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
run: mkdocs build --strict
9292

9393
- name: store docs site
94-
uses: actions/upload-artifact@v3
94+
uses: actions/upload-artifact@v4
9595
with:
9696
name: docs
9797
path: site

.github/workflows/upload-previews.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- run: pip install click==8.0.4
2222
- run: pip install smokeshow
2323

24-
- uses: dawidd6/action-download-artifact@v2
24+
- uses: dawidd6/action-download-artifact@v11
2525
with:
2626
workflow: ci.yml
2727
commit: ${{ github.event.workflow_run.head_sha }}

dirty_equals/_sequence.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
from typing import TYPE_CHECKING, Any, Container, Dict, List, Optional, Sized, Tuple, Type, TypeVar, Union, overload
23

34
from ._base import DirtyEquals
@@ -6,9 +7,14 @@
67
if TYPE_CHECKING:
78
from typing import TypeAlias
89

10+
if sys.version_info >= (3, 10):
11+
from types import EllipsisType
12+
else:
13+
EllipsisType = Any
14+
915
__all__ = 'HasLen', 'Contains', 'IsListOrTuple', 'IsList', 'IsTuple'
1016
T = TypeVar('T', List[Any], Tuple[Any, ...])
11-
LengthType: 'TypeAlias' = 'Union[None, int, Tuple[int, Union[int, Any]]]'
17+
LengthType: 'TypeAlias' = 'Union[None, int, Tuple[int, Union[int, Any]], EllipsisType]'
1218

1319

1420
class HasLen(DirtyEquals[Sized]):

0 commit comments

Comments
 (0)