We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 08fe8b9 commit 80390ffCopy full SHA for 80390ff
2 files changed
docx/text.py
@@ -43,6 +43,10 @@ def style(self):
43
style = self._p.style
44
return style if style is not None else 'Normal'
45
46
+ @style.setter
47
+ def style(self, style):
48
+ self._p.style = None if style == 'Normal' else style
49
+
50
51
class Run(object):
52
"""
tests/test_text.py
@@ -59,6 +59,17 @@ def it_knows_its_paragraph_style(self):
59
p = Paragraph(p_elm)
60
assert p.style == expected_style
61
62
+ def it_can_set_its_paragraph_style(self):
63
+ cases = (
64
+ ('foobar', 'foobar'),
65
+ ('Normal', None),
66
+ )
67
+ for style, expected_setting in cases:
68
+ p_elm = Mock(name='p_elm')
69
+ p = Paragraph(p_elm)
70
+ p.style = style
71
+ assert p_elm.style == expected_setting
72
73
74
class DescribeRun(object):
75
0 commit comments