()
| 58 | |
| 59 | |
| 60 | def test_shared(): |
| 61 | rdim = (4, 4, 2) |
| 62 | share = { |
| 63 | 'all': np.ones(rdim[:2], dtype=bool), |
| 64 | 'none': np.zeros(rdim[:2], dtype=bool), |
| 65 | 'row': np.array([ |
| 66 | [False, True, False, False], |
| 67 | [True, False, False, False], |
| 68 | [False, False, False, True], |
| 69 | [False, False, True, False]]), |
| 70 | 'col': np.array([ |
| 71 | [False, False, True, False], |
| 72 | [False, False, False, True], |
| 73 | [True, False, False, False], |
| 74 | [False, True, False, False]]), |
| 75 | } |
| 76 | visible = { |
| 77 | 'x': { |
| 78 | 'all': [False, False, True, True], |
| 79 | 'col': [False, False, True, True], |
| 80 | 'row': [True] * 4, |
| 81 | 'none': [True] * 4, |
| 82 | False: [True] * 4, |
| 83 | True: [False, False, True, True], |
| 84 | }, |
| 85 | 'y': { |
| 86 | 'all': [True, False, True, False], |
| 87 | 'col': [True] * 4, |
| 88 | 'row': [True, False, True, False], |
| 89 | 'none': [True] * 4, |
| 90 | False: [True] * 4, |
| 91 | True: [True, False, True, False], |
| 92 | }, |
| 93 | } |
| 94 | share[False] = share['none'] |
| 95 | share[True] = share['all'] |
| 96 | |
| 97 | # test default |
| 98 | f, ((a1, a2), (a3, a4)) = plt.subplots(2, 2) |
| 99 | axs = [a1, a2, a3, a4] |
| 100 | check_shared(axs, share['none'], share['none']) |
| 101 | plt.close(f) |
| 102 | |
| 103 | # test all option combinations |
| 104 | ops = [False, True, 'all', 'none', 'row', 'col', 0, 1] |
| 105 | for xo in ops: |
| 106 | for yo in ops: |
| 107 | f, ((a1, a2), (a3, a4)) = plt.subplots(2, 2, sharex=xo, sharey=yo) |
| 108 | axs = [a1, a2, a3, a4] |
| 109 | check_shared(axs, share[xo], share[yo]) |
| 110 | check_ticklabel_visible(axs, visible['x'][xo], visible['y'][yo]) |
| 111 | plt.close(f) |
| 112 | |
| 113 | |
| 114 | @pytest.mark.parametrize('remove_ticks', [True, False]) |
nothing calls this directly
no test coverage detected
searching dependent graphs…