Skip to content

Commit 8efe8ad

Browse files
author
Steve Canny
committed
acpt: rewrite scenarios for Table add row & column
1 parent 558a124 commit 8efe8ad

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

features/steps/table.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,9 @@ def given_a_table_having_two_rows(context):
130130

131131
# when =====================================================
132132

133-
@when('I add a column to the table')
134-
def when_add_column_to_table(context):
135-
table = context.table_
136-
context.column = table.add_column()
133+
@when('I add a 1.0 inch column to the table')
134+
def when_I_add_a_1_inch_column_to_table(context):
135+
context.column = context.table_.add_column(Inches(1.0))
137136

138137

139138
@when('I add a row to the table')
@@ -299,6 +298,11 @@ def then_new_column_has_2_cells(context):
299298
assert len(context.column.cells) == 2
300299

301300

301+
@then('the new column is 1.0 inches wide')
302+
def then_new_column_is_1_inches_wide(context):
303+
assert context.column.width == Inches(1)
304+
305+
302306
@then('the new row has 2 cells')
303307
def then_new_row_has_2_cells(context):
304308
assert len(context.row.cells) == 2

features/tbl-add-row-or-col.feature

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,20 @@ Feature: Add a row or column to a table
33
As a developer using python-docx
44
I need methods to add a row or column
55

6+
7+
@wip
68
Scenario: Add a row to a table
79
Given a 2 x 2 table
810
When I add a row to the table
911
Then the table has 3 rows
1012
And the new row has 2 cells
13+
And the width of each cell is 3.0 inches
14+
1115

16+
@wip
1217
Scenario: Add a column to a table
1318
Given a 2 x 2 table
14-
When I add a column to the table
19+
When I add a 1.0 inch column to the table
1520
Then the table has 3 columns
1621
And the new column has 2 cells
22+
And the new column is 1.0 inches wide

0 commit comments

Comments
 (0)