Skip to content

Commit 5c844d9

Browse files
committed
Add tests asserting that protocols match stdlib also.
1 parent 95967ae commit 5c844d9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

importlib_metadata/_meta.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
Protocol,
88
TypeVar,
99
overload,
10+
runtime_checkable,
1011
)
1112

1213
_T = TypeVar("_T")
1314

1415

16+
@runtime_checkable
1517
class PackageMetadata(Protocol):
1618
def __len__(self) -> int: ... # pragma: no cover
1719

@@ -71,6 +73,7 @@ def read_bytes(self) -> bytes: ... # pragma: no cover
7173
def exists(self) -> bool: ... # pragma: no cover
7274

7375

76+
@runtime_checkable
7477
class IPackagePath(Protocol):
7578
hash: Any | None
7679
size: int | None
@@ -88,6 +91,7 @@ def parts(self) -> tuple[str, ...]: ... # pragma: no cover
8891
def __fspath__(self) -> str: ... # pragma: no cover
8992

9093

94+
@runtime_checkable
9195
class IDistribution(Protocol):
9296
def read_text(
9397
self, filename: str | os.PathLike[str]

0 commit comments

Comments
 (0)