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

Skip to content

Commit 39cecdc

Browse files
Zair Mubashardkua
authored andcommitted
Tests for new Table Cell feature (4044) added
1 parent 4542ee7 commit 39cecdc

5 files changed

Lines changed: 28 additions & 17 deletions

File tree

54.8 KB
Loading
54.4 KB
Loading
16.9 KB
Loading
-28.5 KB
Binary file not shown.

lib/matplotlib/tests/test_table.py

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

8383

84-
@image_comparison(baseline_images=['table_types'],
85-
extensions=['png'])
86-
def test_table_types():
87-
fig = plt.figure()
84+
@image_comparison(baseline_images=['table_cell_manipulation1',
85+
'table_cell_manipulation2', 'table_cell_manipulation3'],
86+
extensions=['png', 'png', 'png'])
87+
def test_diff_cell_table():
8888
l1 = ["", "t0", "t1", "t2", "t3 ", "t4", "t5", "t6"]
8989
l2 = ["DLI", 35, 38, 10, 22, 25, 85, 22]
9090

91-
ax1 = fig.add_subplot(4, 1, 1)
92-
ax1.plot([1, 2, 3, 4, 5, 6])
93-
ax1.table(
94-
colWidths=[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
95-
cellText=[l1, l2],
96-
loc="upper center",
97-
colLoc="center",
98-
rowLoc="center",
99-
)
91+
test_cell = ['horizontal', 'vertical', 'open', 'closed',
92+
'T', 'R', 'B', 'L']
10093

101-
ax2 = fig.add_subplot(4, 1, 2)
102-
ax2.plot([1, 2, 3, 4, 5, 6])
103-
ax2.table(
94+
ax = None
95+
for i in range(0, 8):
96+
97+
if (i % 4) == 0:
98+
fig = plt.figure()
99+
100+
ax = fig.add_subplot(4, 1, (i % 4) + 1)
101+
ax.plot([1, 2, 3, 4, 5, 6])
102+
ax.table(
104103
colWidths=[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
105104
cellText=[l1, l2],
106105
loc="upper center",
107106
colLoc="center",
108107
rowLoc="center",
109-
cellType="scientific",
108+
drawLines=test_cell[i]
110109
)
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+
)

0 commit comments

Comments
 (0)