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

Skip to content

Commit 7b32f5e

Browse files
committed
Cleaned up test for test_table
1 parent 39cecdc commit 7b32f5e

2 files changed

Lines changed: 16 additions & 34 deletions

File tree

83.8 KB
Loading

lib/matplotlib/tests/test_table.py

Lines changed: 16 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -81,41 +81,23 @@ def test_label_colours():
8181
loc='best')
8282

8383

84-
@image_comparison(baseline_images=['table_cell_manipulation1',
85-
'table_cell_manipulation2', 'table_cell_manipulation3'],
86-
extensions=['png', 'png', 'png'])
84+
@image_comparison(baseline_images=['table_cell_manipulation'],
85+
extensions=['png'])
8786
def test_diff_cell_table():
88-
l1 = ["", "t0", "t1", "t2", "t3 ", "t4", "t5", "t6"]
89-
l2 = ["DLI", 35, 38, 10, 22, 25, 85, 22]
90-
91-
test_cell = ['horizontal', 'vertical', 'open', 'closed',
92-
'T', 'R', 'B', 'L']
93-
94-
ax = None
95-
for i in range(0, 8):
96-
97-
if (i % 4) == 0:
98-
fig = plt.figure()
87+
l1 = ('', 't0', 't1', 't2', 't3 ', 't4', 't5', 't6')
88+
l2 = ('DLI', 35, 38, 10, 22, 25, 85, 22)
89+
cells = ('horizontal', 'vertical', 'open', 'closed', 'T', 'R', 'B', 'L')
9990

100-
ax = fig.add_subplot(4, 1, (i % 4) + 1)
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)
10194
ax.plot([1, 2, 3, 4, 5, 6])
10295
ax.table(
103-
colWidths=[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
104-
cellText=[l1, l2],
105-
loc="upper center",
106-
colLoc="center",
107-
rowLoc="center",
108-
drawLines=test_cell[i]
109-
)
110-
111-
fig = plt.figure()
112-
113-
ax = fig.add_subplot(4, 1, 1)
114-
ax.plot([1, 2, 3, 4, 5, 6])
115-
ax.table(
116-
colWidths=[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
117-
cellText=[l1, l2],
118-
loc="upper center",
119-
colLoc="center",
120-
rowLoc="center",
121-
)
96+
colWidths=[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
97+
cellText=[l1, l2],
98+
loc='center',
99+
colLoc='center',
100+
rowLoc='center',
101+
drawLines=cell,
102+
)
103+
plt.tight_layout()

0 commit comments

Comments
 (0)