Skip to content

Commit b5c4a5e

Browse files
author
Steve Canny
committed
tbl: add Table.table
1 parent f0ade55 commit b5c4a5e

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

docx/table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def table(self):
101101
a |Table| object. This is the terminus of a series of `parent._table`
102102
calls from an arbitrary child through its ancestors.
103103
"""
104-
raise NotImplementedError
104+
return self
105105

106106
@property
107107
def _tblPr(self):

tests/test_table.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ def it_can_change_its_autofit_setting(self, autofit_set_fixture):
7171
table.autofit = new_value
7272
assert table._tbl.xml == expected_xml
7373

74+
def it_knows_it_is_the_table_its_children_belong_to(self, table_fixture):
75+
table = table_fixture
76+
assert table.table is table
77+
7478
# fixtures -------------------------------------------------------
7579

7680
@pytest.fixture
@@ -116,6 +120,11 @@ def autofit_set_fixture(self, request):
116120
expected_xml = xml(expected_tbl_cxml)
117121
return table, new_value, expected_xml
118122

123+
@pytest.fixture
124+
def table_fixture(self):
125+
table = Table(None, None)
126+
return table
127+
119128
@pytest.fixture(params=[
120129
('w:tbl/w:tblPr', None),
121130
('w:tbl/w:tblPr/w:tblStyle{w:val=foobar}', 'foobar'),

0 commit comments

Comments
 (0)