async def test_notifier_remove_observer(notifier: Notifier): def callback1(): ... def callback2(): ... notifier.add_observer('topic', callback1) notifier.add_observer('topic', callback2) notifier.remove_observer('topic', callback1) assert notifier.observers['topic'] == {callback2: True}
async def test_notifier_remove_nonexistent_observer(notifier: Notifier): # test that `remove_observer` don't crash in case of calling to remove non existed topic/callback notifier.remove_observer('nonexistent', lambda: None) assert not notifier.observers['nonexistent']