diff --git a/py/matching.py b/py/matching.py index da74ee5..b526876 100644 --- a/py/matching.py +++ b/py/matching.py @@ -33,6 +33,10 @@ class Role(Protocol): def id(self) -> int: pass + @property + def name(self) -> str: + pass + @runtime_checkable class Member(Protocol): @@ -53,13 +57,6 @@ class Member(Protocol): pass -@runtime_checkable -class Role(Protocol): - @property - def name(self) -> str: - pass - - @runtime_checkable class Guild(Protocol): @property diff --git a/py/matching_test.py b/py/matching_test.py index 21f7c83..f9942de 100644 --- a/py/matching_test.py +++ b/py/matching_test.py @@ -17,7 +17,7 @@ def test_protocols(): assert isinstance(discord.Guild, matching.Guild) assert isinstance(discord.Role, matching.Role) assert isinstance(Member, matching.Member) - # assert isinstance(Role, matching.Role) + assert isinstance(Role, matching.Role) class Role(): @@ -28,6 +28,10 @@ class Role(): def id(self) -> int: return self._id + @property + def name(self) -> str: + pass + class Member(): def __init__(self, id: int, roles: list[Role] = []): @@ -38,6 +42,10 @@ class Member(): def mention(self) -> str: return f"<@{self._id}>" + @property + def display_name(self) -> str: + return f"{self._id}" + @property def roles(self) -> list[Role]: return self._roles