Skip to content

Commit b58aace

Browse files
committed
forgot we talked about removing the protocol earlier this summer.
1 parent 4f8d365 commit b58aace

3 files changed

Lines changed: 2 additions & 31 deletions

File tree

screenpy/protocols.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,3 @@ def attach(self, filepath: str, **kwargs: Any) -> None: # noqa: ANN401
134134
135135
Pass keyword arguments for specific adapters' needs.
136136
"""
137-
138-
139-
@runtime_checkable
140-
class Silenceable(Protocol):
141-
"""Classes wrapped in Silently are Silenceable."""
142-
143-
_silenced: bool

screenpy/speech_tools.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@
88

99
from hamcrest.core.helpers.hasmethod import hasmethod
1010

11-
from screenpy.protocols import (
12-
Answerable,
13-
Describable,
14-
Performable,
15-
Resolvable,
16-
Silenceable,
17-
)
11+
from screenpy.protocols import Answerable, Describable, Performable, Resolvable
1812

1913
T = TypeVar("T")
2014

@@ -83,6 +77,4 @@ def represent_prop(item: str | T | mock.Mock) -> str | mock.Mock:
8377

8478
def is_silent(duck: Performable | Resolvable | Answerable) -> bool:
8579
"""Check if a duck has been silenced."""
86-
if isinstance(duck, Silenceable):
87-
return duck._silenced
88-
return False
80+
return getattr(duck, "_silenced", False)

tests/test_actions.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
the_narrator,
3636
)
3737
from screenpy.configuration import ScreenPySettings
38-
from screenpy.protocols import Silenceable
3938
from screenpy.speech_tools import is_silent
4039

4140
from .unittest_protocols import ErrorQuestion
@@ -863,13 +862,6 @@ def test_implements_protocol(self) -> None:
863862
assert isinstance(q1, Describable)
864863
assert isinstance(q2, Describable)
865864
assert isinstance(q3, Describable)
866-
assert isinstance(q1, Silenceable)
867-
assert isinstance(q2, Silenceable)
868-
assert isinstance(q3, Silenceable)
869-
870-
assert not isinstance(FakeQuestion(), Silenceable)
871-
assert not isinstance(FakeAction(), Silenceable)
872-
assert not isinstance(FakeResolution(), Silenceable)
873865

874866
def test_passthru_attribute(self) -> None:
875867
a = FakeAction()
@@ -952,9 +944,6 @@ def test_sets_silenced_attribute_false(self) -> None:
952944
assert is_silent(q1) is False
953945
assert is_silent(q2) is False
954946
assert is_silent(q3) is False
955-
assert isinstance(q1, Silenceable)
956-
assert isinstance(q2, Silenceable)
957-
assert isinstance(q3, Silenceable)
958947

959948
def test_sets_silenced_attribute_true(self) -> None:
960949
mock_settings = ScreenPySettings(UNABRIDGED_NARRATION=False)
@@ -969,9 +958,6 @@ def test_sets_silenced_attribute_true(self) -> None:
969958
assert is_silent(q1) is True
970959
assert is_silent(q2) is True
971960
assert is_silent(q3) is True
972-
assert isinstance(q1, Silenceable)
973-
assert isinstance(q2, Silenceable)
974-
assert isinstance(q3, Silenceable)
975961

976962
def test_kinking(self, Tester: Actor, mocker: MockerFixture) -> None:
977963
mock_clear = mocker.spy(the_narrator, "clear_backup")

0 commit comments

Comments
 (0)