Skip to content

Commit 13c7026

Browse files
authored
Rework doctest to avoid callback ordering issues
1 parent 2c9c5ed commit 13c7026

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

pydispatch/decorators.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,14 @@ def receiver(
7272
7373
Receiving multiple events
7474
75-
>>> @pydispatch.receiver(['foo', 'bar', 'baz'])
76-
... def on_foobarbaz(value, **kwargs):
77-
... print(f'on_foobarbaz: "{value}"')
78-
79-
>>> pydispatch.emit('foo', 1)
80-
on_foo: "1"
81-
on_foobarbaz: "1"
82-
83-
>>> pydispatch.emit('bar', 2)
84-
on_bar: "2"
85-
on_foobarbaz: "2"
75+
>>> @pydispatch.receiver(['event_one', 'event_two'], auto_register=True)
76+
... def on_event_one_or_two(value, **kwargs):
77+
... print(value)
78+
79+
>>> pydispatch.emit('event_one', 1)
80+
1
81+
>>> pydispatch.emit('event_two', 2)
82+
2
8683
8784
8885
Arguments:

0 commit comments

Comments
 (0)