mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
Add stubs for assertpy (#11916)
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
"stdlib/xml/sax",
|
||||
"stubs/aiofiles/aiofiles/tempfile/temptypes.pyi",
|
||||
"stubs/antlr4-python3-runtime",
|
||||
"stubs/assertpy",
|
||||
"stubs/aws-xray-sdk",
|
||||
"stubs/beautifulsoup4",
|
||||
"stubs/bleach/bleach/sanitizer.pyi",
|
||||
|
||||
11
stubs/assertpy/@tests/stubtest_allowlist.txt
Normal file
11
stubs/assertpy/@tests/stubtest_allowlist.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
assertpy.collection.Iterable
|
||||
assertpy.contains.str_types
|
||||
assertpy.contains.xrange
|
||||
assertpy.dynamic.Iterable
|
||||
assertpy.exception.Iterable
|
||||
assertpy.extracting.Iterable
|
||||
assertpy.extracting.str_types
|
||||
assertpy.file.str_types
|
||||
assertpy.helpers.Iterable
|
||||
assertpy.string.Iterable
|
||||
assertpy.string.str_types
|
||||
2
stubs/assertpy/METADATA.toml
Normal file
2
stubs/assertpy/METADATA.toml
Normal file
@@ -0,0 +1,2 @@
|
||||
version = "1.1.*"
|
||||
upstream_repository = "https://github.com/assertpy/assertpy"
|
||||
12
stubs/assertpy/assertpy/__init__.pyi
Normal file
12
stubs/assertpy/assertpy/__init__.pyi
Normal file
@@ -0,0 +1,12 @@
|
||||
from .assertpy import (
|
||||
WarningLoggingAdapter as WarningLoggingAdapter,
|
||||
__version__ as __version__,
|
||||
add_extension as add_extension,
|
||||
assert_that as assert_that,
|
||||
assert_warn as assert_warn,
|
||||
fail as fail,
|
||||
remove_extension as remove_extension,
|
||||
soft_assertions as soft_assertions,
|
||||
soft_fail as soft_fail,
|
||||
)
|
||||
from .file import contents_of as contents_of
|
||||
70
stubs/assertpy/assertpy/assertpy.pyi
Normal file
70
stubs/assertpy/assertpy/assertpy.pyi
Normal file
@@ -0,0 +1,70 @@
|
||||
import logging
|
||||
from collections.abc import Callable, Generator
|
||||
from typing import Any
|
||||
from typing_extensions import Self
|
||||
|
||||
from .base import BaseMixin
|
||||
from .collection import CollectionMixin
|
||||
from .contains import ContainsMixin
|
||||
from .date import DateMixin
|
||||
from .dict import DictMixin
|
||||
from .dynamic import DynamicMixin
|
||||
from .exception import ExceptionMixin
|
||||
from .extracting import ExtractingMixin
|
||||
from .file import FileMixin
|
||||
from .helpers import HelpersMixin
|
||||
from .numeric import NumericMixin
|
||||
from .snapshot import SnapshotMixin
|
||||
from .string import StringMixin
|
||||
|
||||
__version__: str
|
||||
__tracebackhide__: bool
|
||||
|
||||
class WarningLoggingAdapter(logging.LoggerAdapter[logging.Logger]):
|
||||
def process(self, msg: str, kwargs: Any) -> tuple[str, Any]: ...
|
||||
|
||||
class AssertionBuilder(
|
||||
StringMixin,
|
||||
SnapshotMixin,
|
||||
NumericMixin,
|
||||
HelpersMixin,
|
||||
FileMixin,
|
||||
ExtractingMixin,
|
||||
ExceptionMixin,
|
||||
DynamicMixin,
|
||||
DictMixin,
|
||||
DateMixin,
|
||||
ContainsMixin,
|
||||
CollectionMixin,
|
||||
BaseMixin,
|
||||
):
|
||||
val: Any
|
||||
description: str
|
||||
kind: str | None
|
||||
expected: BaseException | None
|
||||
logger: logging.Logger
|
||||
def __init__(
|
||||
self,
|
||||
val: Any,
|
||||
description: str = "",
|
||||
kind: str | None = None,
|
||||
expected: BaseException | None = None,
|
||||
logger: logging.Logger | None = None,
|
||||
) -> None: ...
|
||||
def builder(
|
||||
self,
|
||||
val: Any,
|
||||
description: str = "",
|
||||
kind: str | None = None,
|
||||
expected: BaseException | None = None,
|
||||
logger: logging.Logger | None = None,
|
||||
) -> Self: ...
|
||||
def error(self, msg: str) -> Self: ...
|
||||
|
||||
def soft_assertions() -> Generator[None, None, None]: ...
|
||||
def assert_that(val: Any, description: str = "") -> AssertionBuilder: ...
|
||||
def assert_warn(val: Any, description: str = "", logger: logging.Logger | None = None) -> AssertionBuilder: ...
|
||||
def fail(msg: str = "") -> None: ...
|
||||
def soft_fail(msg: str = "") -> None: ...
|
||||
def add_extension(func: Callable[[AssertionBuilder], AssertionBuilder]) -> None: ...
|
||||
def remove_extension(func: Callable[[AssertionBuilder], AssertionBuilder]) -> None: ...
|
||||
21
stubs/assertpy/assertpy/base.pyi
Normal file
21
stubs/assertpy/assertpy/base.pyi
Normal file
@@ -0,0 +1,21 @@
|
||||
from typing import Any
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
__tracebackhide__: bool
|
||||
|
||||
_IncludeIgnore: TypeAlias = str | list[str] | list[tuple[str, ...]] | None
|
||||
|
||||
class BaseMixin:
|
||||
description: str
|
||||
def described_as(self, description: str) -> Self: ...
|
||||
def is_equal_to(self, other: Any, *, include: _IncludeIgnore = None, ignore: _IncludeIgnore = None) -> Self: ...
|
||||
def is_not_equal_to(self, other: Any) -> Self: ...
|
||||
def is_same_as(self, other: Any) -> Self: ...
|
||||
def is_not_same_as(self, other: Any) -> Self: ...
|
||||
def is_true(self) -> Self: ...
|
||||
def is_false(self) -> Self: ...
|
||||
def is_none(self) -> Self: ...
|
||||
def is_not_none(self) -> Self: ...
|
||||
def is_type_of(self, some_type: type) -> Self: ...
|
||||
def is_instance_of(self, some_class: type) -> Self: ...
|
||||
def is_length(self, length: int) -> Self: ...
|
||||
11
stubs/assertpy/assertpy/collection.pyi
Normal file
11
stubs/assertpy/assertpy/collection.pyi
Normal file
@@ -0,0 +1,11 @@
|
||||
from collections.abc import Callable
|
||||
from typing import Any
|
||||
from typing_extensions import Self
|
||||
|
||||
__tracebackhide__: bool
|
||||
|
||||
class CollectionMixin:
|
||||
def is_iterable(self) -> Self: ...
|
||||
def is_not_iterable(self) -> Self: ...
|
||||
def is_subset_of(self, *supersets: Any) -> Self: ...
|
||||
def is_sorted(self, key: Callable[[Any], Any] = ..., reverse: bool = False) -> Self: ...
|
||||
16
stubs/assertpy/assertpy/contains.pyi
Normal file
16
stubs/assertpy/assertpy/contains.pyi
Normal file
@@ -0,0 +1,16 @@
|
||||
from typing import Any
|
||||
from typing_extensions import Self
|
||||
|
||||
__tracebackhide__: bool
|
||||
|
||||
class ContainsMixin:
|
||||
def contains(self, *items: Any) -> Self: ...
|
||||
def does_not_contain(self, *items: Any) -> Self: ...
|
||||
def contains_only(self, *items: Any) -> Self: ...
|
||||
def contains_sequence(self, *items: Any) -> Self: ...
|
||||
def contains_duplicates(self) -> Self: ...
|
||||
def does_not_contain_duplicates(self) -> Self: ...
|
||||
def is_empty(self) -> Self: ...
|
||||
def is_not_empty(self) -> Self: ...
|
||||
def is_in(self, *items: Any) -> Self: ...
|
||||
def is_not_in(self, *items: Any) -> Self: ...
|
||||
11
stubs/assertpy/assertpy/date.pyi
Normal file
11
stubs/assertpy/assertpy/date.pyi
Normal file
@@ -0,0 +1,11 @@
|
||||
from datetime import date
|
||||
from typing_extensions import Self
|
||||
|
||||
__tracebackhide__: bool
|
||||
|
||||
class DateMixin:
|
||||
def is_before(self, other: date) -> Self: ...
|
||||
def is_after(self, other: date) -> Self: ...
|
||||
def is_equal_to_ignoring_milliseconds(self, other: date) -> Self: ...
|
||||
def is_equal_to_ignoring_seconds(self, other: date) -> Self: ...
|
||||
def is_equal_to_ignoring_time(self, other: date) -> Self: ...
|
||||
12
stubs/assertpy/assertpy/dict.pyi
Normal file
12
stubs/assertpy/assertpy/dict.pyi
Normal file
@@ -0,0 +1,12 @@
|
||||
from typing import Any
|
||||
from typing_extensions import Self
|
||||
|
||||
__tracebackhide__: bool
|
||||
|
||||
class DictMixin:
|
||||
def contains_key(self, *keys: Any) -> Self: ...
|
||||
def does_not_contain_key(self, *keys: Any) -> Self: ...
|
||||
def contains_value(self, *values: Any) -> Self: ...
|
||||
def does_not_contain_value(self, *values: Any) -> Self: ...
|
||||
def contains_entry(self, *args: Any, **kwargs: dict[str, Any]) -> Self: ...
|
||||
def does_not_contain_entry(self, *args: Any, **kwargs: dict[str, Any]) -> Self: ...
|
||||
7
stubs/assertpy/assertpy/dynamic.pyi
Normal file
7
stubs/assertpy/assertpy/dynamic.pyi
Normal file
@@ -0,0 +1,7 @@
|
||||
from collections.abc import Callable
|
||||
from typing_extensions import Self
|
||||
|
||||
__tracebackhide__: bool
|
||||
|
||||
class DynamicMixin:
|
||||
def __getattr__(self, attr: str) -> Callable[..., Self]: ...
|
||||
8
stubs/assertpy/assertpy/exception.pyi
Normal file
8
stubs/assertpy/assertpy/exception.pyi
Normal file
@@ -0,0 +1,8 @@
|
||||
from typing import Any
|
||||
from typing_extensions import Self
|
||||
|
||||
__tracebackhide__: bool
|
||||
|
||||
class ExceptionMixin:
|
||||
def raises(self, ex: type[BaseException] | BaseException) -> Self: ...
|
||||
def when_called_with(self, *some_args: Any, **some_kwargs: dict[str, Any]) -> Self: ...
|
||||
7
stubs/assertpy/assertpy/extracting.pyi
Normal file
7
stubs/assertpy/assertpy/extracting.pyi
Normal file
@@ -0,0 +1,7 @@
|
||||
from typing import Any
|
||||
from typing_extensions import Self
|
||||
|
||||
__tracebackhide__: bool
|
||||
|
||||
class ExtractingMixin:
|
||||
def extracting(self, *names: Any, **kwargs: dict[str, Any]) -> Self: ...
|
||||
15
stubs/assertpy/assertpy/file.pyi
Normal file
15
stubs/assertpy/assertpy/file.pyi
Normal file
@@ -0,0 +1,15 @@
|
||||
from _typeshed import StrPath
|
||||
from typing import IO, AnyStr
|
||||
from typing_extensions import Self
|
||||
|
||||
__tracebackhide__: bool
|
||||
|
||||
def contents_of(file: IO[AnyStr] | StrPath, encoding: str = "utf-8") -> str: ...
|
||||
|
||||
class FileMixin:
|
||||
def exists(self) -> Self: ...
|
||||
def does_not_exist(self) -> Self: ...
|
||||
def is_file(self) -> Self: ...
|
||||
def is_directory(self) -> Self: ...
|
||||
def is_named(self, filename: str) -> Self: ...
|
||||
def is_child_of(self, parent: str) -> Self: ...
|
||||
3
stubs/assertpy/assertpy/helpers.pyi
Normal file
3
stubs/assertpy/assertpy/helpers.pyi
Normal file
@@ -0,0 +1,3 @@
|
||||
__tracebackhide__: bool
|
||||
|
||||
class HelpersMixin: ...
|
||||
24
stubs/assertpy/assertpy/numeric.pyi
Normal file
24
stubs/assertpy/assertpy/numeric.pyi
Normal file
@@ -0,0 +1,24 @@
|
||||
from datetime import date
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
__tracebackhide__: bool
|
||||
|
||||
_Numeric: TypeAlias = date | int | float
|
||||
|
||||
class NumericMixin:
|
||||
def is_zero(self) -> Self: ...
|
||||
def is_not_zero(self) -> Self: ...
|
||||
def is_nan(self) -> Self: ...
|
||||
def is_not_nan(self) -> Self: ...
|
||||
def is_inf(self) -> Self: ...
|
||||
def is_not_inf(self) -> Self: ...
|
||||
def is_greater_than(self, other: _Numeric) -> Self: ...
|
||||
def is_greater_than_or_equal_to(self, other: _Numeric) -> Self: ...
|
||||
def is_less_than(self, other: _Numeric) -> Self: ...
|
||||
def is_less_than_or_equal_to(self, other: _Numeric) -> Self: ...
|
||||
def is_positive(self) -> Self: ...
|
||||
def is_negative(self) -> Self: ...
|
||||
def is_between(self, low: _Numeric, high: _Numeric) -> Self: ...
|
||||
def is_not_between(self, low: _Numeric, high: _Numeric) -> Self: ...
|
||||
def is_close_to(self, other: _Numeric, tolerance: _Numeric) -> Self: ...
|
||||
def is_not_close_to(self, other: _Numeric, tolerance: _Numeric) -> Self: ...
|
||||
6
stubs/assertpy/assertpy/snapshot.pyi
Normal file
6
stubs/assertpy/assertpy/snapshot.pyi
Normal file
@@ -0,0 +1,6 @@
|
||||
from typing_extensions import Self
|
||||
|
||||
__tracebackhide__: bool
|
||||
|
||||
class SnapshotMixin:
|
||||
def snapshot(self, id: str | None = None, path: str = "__snapshots") -> Self: ...
|
||||
18
stubs/assertpy/assertpy/string.pyi
Normal file
18
stubs/assertpy/assertpy/string.pyi
Normal file
@@ -0,0 +1,18 @@
|
||||
from re import Pattern
|
||||
from typing_extensions import Self
|
||||
|
||||
unicode = str
|
||||
__tracebackhide__: bool
|
||||
|
||||
class StringMixin:
|
||||
def is_equal_to_ignoring_case(self, other: str) -> Self: ...
|
||||
def contains_ignoring_case(self, *items: str) -> Self: ...
|
||||
def starts_with(self, prefix: str) -> Self: ...
|
||||
def ends_with(self, suffix: str) -> Self: ...
|
||||
def matches(self, pattern: Pattern[str]) -> Self: ...
|
||||
def does_not_match(self, pattern: Pattern[str]) -> Self: ...
|
||||
def is_alpha(self) -> Self: ...
|
||||
def is_digit(self) -> Self: ...
|
||||
def is_lower(self) -> Self: ...
|
||||
def is_upper(self) -> Self: ...
|
||||
def is_unicode(self) -> Self: ...
|
||||
Reference in New Issue
Block a user