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

Skip to content

Commit 9337be7

Browse files
committed
Updated tests to be more minimal.
1 parent b68c05f commit 9337be7

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

lib/matplotlib/tests/test_table.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,19 @@ def test_label_colours():
8282

8383

8484
@image_comparison(baseline_images=['table_cell_manipulation'],
85-
extensions=['png'])
85+
extensions=['png'], remove_text=True)
8686
def test_diff_cell_table():
87-
l1 = ('', 't0', 't1', 't2', 't3 ', 't4', 't5', 't6')
88-
l2 = ('DLI', 35, 38, 10, 22, 25, 85, 22)
8987
cells = ('horizontal', 'vertical', 'open', 'closed', 'T', 'R', 'B', 'L')
88+
cellText = [['1'] * len(cells)] * 2
89+
colWidths = [0.1] * len(cells)
9090

91-
fig = plt.figure(figsize=(4, len(cells)+1))
92-
for i, cell in enumerate(cells, 1):
93-
ax = fig.add_subplot(8, 1, i)
94-
ax.plot([1, 2, 3, 4, 5, 6])
91+
_, axes = plt.subplots(nrows=len(cells), figsize=(4, len(cells)+1))
92+
for ax, cell in zip(axes, cells):
9593
ax.table(
96-
colWidths=[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
97-
cellText=[l1, l2],
94+
colWidths=colWidths,
95+
cellText=cellText,
9896
loc='center',
99-
colLoc='center',
100-
rowLoc='center',
10197
edges=cell,
10298
)
99+
ax.axis('off')
103100
plt.tight_layout()

0 commit comments

Comments
 (0)