|
26 | 26 |
|
27 | 27 | class DescribeParagraph(object): |
28 | 28 |
|
29 | | - def it_provides_access_to_the_runs_it_contains(self, runs_fixture): |
30 | | - paragraph, Run_, r_, r_2_, run_, run_2_ = runs_fixture |
31 | | - runs = paragraph.runs |
32 | | - assert Run_.mock_calls == [ |
33 | | - call(r_, paragraph), call(r_2_, paragraph) |
34 | | - ] |
35 | | - assert runs == [run_, run_2_] |
36 | | - |
37 | | - def it_can_add_a_run_to_itself(self, add_run_fixture): |
38 | | - paragraph, text, style, expected_xml = add_run_fixture |
39 | | - run = paragraph.add_run(text, style) |
40 | | - assert paragraph._p.xml == expected_xml |
41 | | - assert isinstance(run, Run) |
42 | | - assert run._r is paragraph._p.r_lst[0] |
43 | | - |
44 | | - def it_knows_its_alignment_value(self, alignment_get_fixture): |
45 | | - paragraph, expected_value = alignment_get_fixture |
46 | | - assert paragraph.alignment == expected_value |
47 | | - |
48 | | - def it_can_change_its_alignment_value(self, alignment_set_fixture): |
49 | | - paragraph, value, expected_xml = alignment_set_fixture |
50 | | - paragraph.alignment = value |
51 | | - assert paragraph._p.xml == expected_xml |
52 | | - |
53 | 29 | def it_knows_its_paragraph_style(self, style_get_fixture): |
54 | 30 | paragraph, style_id_, style_ = style_get_fixture |
55 | 31 | style = paragraph.style |
@@ -77,6 +53,30 @@ def it_can_replace_the_text_it_contains(self, text_set_fixture): |
77 | 53 | paragraph.text = text |
78 | 54 | assert paragraph.text == expected_text |
79 | 55 |
|
| 56 | + def it_knows_its_alignment_value(self, alignment_get_fixture): |
| 57 | + paragraph, expected_value = alignment_get_fixture |
| 58 | + assert paragraph.alignment == expected_value |
| 59 | + |
| 60 | + def it_can_change_its_alignment_value(self, alignment_set_fixture): |
| 61 | + paragraph, value, expected_xml = alignment_set_fixture |
| 62 | + paragraph.alignment = value |
| 63 | + assert paragraph._p.xml == expected_xml |
| 64 | + |
| 65 | + def it_provides_access_to_the_runs_it_contains(self, runs_fixture): |
| 66 | + paragraph, Run_, r_, r_2_, run_, run_2_ = runs_fixture |
| 67 | + runs = paragraph.runs |
| 68 | + assert Run_.mock_calls == [ |
| 69 | + call(r_, paragraph), call(r_2_, paragraph) |
| 70 | + ] |
| 71 | + assert runs == [run_, run_2_] |
| 72 | + |
| 73 | + def it_can_add_a_run_to_itself(self, add_run_fixture): |
| 74 | + paragraph, text, style, expected_xml = add_run_fixture |
| 75 | + run = paragraph.add_run(text, style) |
| 76 | + assert paragraph._p.xml == expected_xml |
| 77 | + assert isinstance(run, Run) |
| 78 | + assert run._r is paragraph._p.r_lst[0] |
| 79 | + |
80 | 80 | def it_can_insert_a_paragraph_before_itself(self, insert_before_fixture): |
81 | 81 | paragraph, text, style, paragraph_, add_run_calls = ( |
82 | 82 | insert_before_fixture |
|
0 commit comments