Skip to content

Commit

Permalink
calls
Browse files Browse the repository at this point in the history
  • Loading branch information
bcherry committed Nov 22, 2024
1 parent 9bb921c commit 48f754d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions livekit-rtc/tests/test_emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ def test_args():

emitter = EventEmitter[EventTypes]()

args_calls = []
calls = []

@emitter.on("whatever")
def on_whatever(first, second, third):
args_calls.append((first, second, third))
calls.append((first, second, third))

emitter.emit("whatever", 1, 2, 3)
emitter.emit("whatever", 1, 2, 3, 4, 5) # only 3 arguments will be passed

assert args_calls == [(1, 2, 3), (1, 2, 3)]
assert calls == [(1, 2, 3), (1, 2, 3)]

with pytest.raises(TypeError):
emitter.emit("whatever", 1, 2)
Expand All @@ -71,16 +71,16 @@ def test_varargs():

emitter = EventEmitter[EventTypes]()

varargs_calls = []
calls = []

@emitter.on("whatever")
def on_whatever_varargs(*args):
varargs_calls.append(args)
calls.append(args)

emitter.emit("whatever", 1, 2, 3, 4, 5)
emitter.emit("whatever", 1, 2)

assert varargs_calls == [(1, 2, 3, 4, 5), (1, 2)]
assert calls == [(1, 2, 3, 4, 5), (1, 2)]


def test_throw():
Expand Down

0 comments on commit 48f754d

Please sign in to comment.