Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit db34cb7

Browse files
committed
TST: more tests of Grouper
This test touches the internals, if Grouper gets refactored this test should be removed.
1 parent 2dfb60b commit db34cb7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/matplotlib/tests/test_cbook.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import (absolute_import, division, print_function,
22
unicode_literals)
33
import itertools
4+
from weakref import ref
45

56
from matplotlib.externals import six
67

@@ -397,3 +398,20 @@ class dummy():
397398

398399
for A, B in itertools.product(objs[1:], objs[1:]):
399400
assert g.joined(A, B)
401+
402+
403+
def test_grouper_private():
404+
class dummy():
405+
pass
406+
objs = [dummy() for j in range(5)]
407+
g = cbook.Grouper()
408+
g.join(*objs)
409+
# reach in and touch the internals !
410+
mapping = g._mapping
411+
412+
for o in objs:
413+
assert ref(o) in mapping
414+
415+
base_set = mapping[ref(objs[0])]
416+
for o in objs[1:]:
417+
assert mapping[ref(o)] is base_set

0 commit comments

Comments
 (0)