Skip to content

Commit bcb0907

Browse files
author
Steve Canny
committed
acpt: add scenario for Run.font
1 parent a618e0a commit bcb0907

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

features/run-access-font.feature

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Feature: Access run font
2+
In order to discover or change the character formatting of a run
3+
As a developer using python-docx
4+
I need access to the font of a run
5+
6+
7+
@wip
8+
Scenario: Access the font of a run
9+
Given a run
10+
Then run.font is the Font object for the run

features/steps/text.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from docx.enum.text import WD_BREAK, WD_UNDERLINE
1515
from docx.oxml import parse_xml
1616
from docx.oxml.ns import nsdecls, qn
17-
from docx.text.run import Run
17+
from docx.text.run import Font, Run
1818

1919
from helpers import test_docx, test_file, test_text
2020

@@ -284,6 +284,13 @@ def then_type_is_page_break(context):
284284
assert attrib == {qn('w:type'): 'page'}
285285

286286

287+
@then('run.font is the Font object for the run')
288+
def then_run_font_is_the_Font_object_for_the_run(context):
289+
run, font = context.run, context.run.font
290+
assert isinstance(font, Font)
291+
assert font.element is run.element
292+
293+
287294
@then('the last item in the run is a break')
288295
def then_last_item_in_run_is_a_break(context):
289296
run = context.run

0 commit comments

Comments
 (0)