Skip to content
Snippets Groups Projects
Commit e488a790 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

TEST: Test Notifier handling GC'd callback functions

parent f6c74748
No related branches found
No related tags found
No related merge requests found
......@@ -204,3 +204,31 @@ def test_skip():
t.notify(topic='topic')
assert default_called[0] == 14
assert topic_called[ 0] == 6
# Make sure there is no error
# if a callback function is GC'd
# fsl/fslpy!470
def test_gc():
class Thing(notifier.Notifier):
pass
t = Thing()
called = []
def callback(thing, topic, value):
called.append((thing, topic, value))
t.register('callback', callback)
t.notify()
assert called == [(t, None, None)]
called[:] = []
callback = None
del callback
t.notify()
assert called == []
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment