Skip to content

Commit

Permalink
try fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
tlambert03 committed Feb 13, 2024
1 parent 9f44dfc commit 6d2c795
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
9 changes: 2 additions & 7 deletions tests/test_evented_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,8 @@ class User(EventedModel):
u1_id_events = Mock()
u2_id_events = Mock()

with pytest.warns(
FutureWarning,
match="Accessing SignalInstance attribute 'connect' on a SignalGroup "
"is deprecated",
):
user1.events.connect(user1_events)
user1.events.connect(user1_events)
user1.events.connect(user1_events)
user1.events.connect(user1_events)

user1.events.id.connect(u1_id_events)
user2.events.id.connect(u2_id_events)
Expand Down
8 changes: 7 additions & 1 deletion tests/test_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ def test_signal_group_connect(direct: bool):
group = MyGroup()
if direct:
# the callback wants the emitted arguments directly
group.all.connect_direct(mock)

with pytest.warns(
FutureWarning,
match="Accessing SignalInstance attribute 'connect_direct' on a SignalGroup"
" is deprecated",
):
group.connect_direct(mock)
else:
# the callback will receive an EmissionInfo tuple
# (SignalInstance, arg_tuple)
Expand Down
3 changes: 2 additions & 1 deletion typesafety/test_group.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
reveal_type(T.e) # N: Revealed type is "psygnal._group_descriptor.SignalGroupDescriptor"
reveal_type(t.e) # N: Revealed type is "psygnal._group.SignalGroup"
reveal_type(t.e['x']) # N: Revealed type is "psygnal._signal.SignalInstance"
# TODO: change after removing getattr deprecation
reveal_type(t.e.x) # N: Revealed type is "Any"
@t.e.x.connect
@t.e['x'].connect
def func(x: int) -> None:
pass
Expand Down

0 comments on commit 6d2c795

Please sign in to comment.