Triggering an event should call all of the listeners with the provided result.
()
| 92 | |
| 93 | |
| 94 | def test_event_trigger(): |
| 95 | """ |
| 96 | Triggering an event should call all of the listeners with the provided |
| 97 | result. |
| 98 | """ |
| 99 | event = Event() |
| 100 | counter = 0 |
| 101 | |
| 102 | def listener(x): |
| 103 | nonlocal counter |
| 104 | counter += 1 |
| 105 | assert x == "ok" |
| 106 | |
| 107 | event.add_listener(listener) |
| 108 | assert counter == 0 |
| 109 | event.trigger("ok") |
| 110 | assert counter == 1 |
| 111 | |
| 112 | |
| 113 | def test_event_trigger_no_listeners(): |
nothing calls this directly
no test coverage detected