Skip to content

Commit f35521a

Browse files
committed
Add test on registration on non empty object
1 parent 458d5cd commit f35521a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

lib/matplotlib/tests/test_cbook.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,32 @@ def test_callback_wrong_disconnect(self):
261261
# check we still have callbacks registered
262262
self.is_not_empty()
263263

264+
@pytest.mark.xfail(reason="must be fixed")
265+
def test_registration_on_non_empty_registry(self):
266+
# ensure we start with an empty registry
267+
self.is_empty()
268+
269+
# setup the registry with a callback
270+
mini_me = Test_callback_registry()
271+
self.connect(self.signal, mini_me.dummy)
272+
273+
# Add another callback
274+
mini_me2 = Test_callback_registry()
275+
self.connect(self.signal, mini_me2.dummy)
276+
277+
# Remove and add the second callback
278+
mini_me2 = Test_callback_registry()
279+
self.connect(self.signal, mini_me2.dummy)
280+
281+
# We still have 2 references
282+
self.is_not_empty()
283+
assert self.count() == 2
284+
285+
# Removing the last 2 references
286+
mini_me = None
287+
mini_me2 = None
288+
self.is_empty()
289+
264290
def dummy(self):
265291
pass
266292

0 commit comments

Comments
 (0)