Beispiel #1
0
 def test_text_setter_sets_single_run_text(self, pList):
     """assignment to _Paragraph.text creates single run containing value"""
     # setup ------------------------
     test_text = 'python-pptx was here!!'
     p_elm = pList[2]
     paragraph = _Paragraph(p_elm, None)
     # exercise ---------------------
     paragraph.text = test_text
     # verify -----------------------
     assert len(paragraph.runs) == 1
     assert paragraph.runs[0].text == test_text
Beispiel #2
0
 def test_text_setter_sets_single_run_text(self, pList):
     """assignment to _Paragraph.text creates single run containing value"""
     # setup ------------------------
     test_text = 'python-pptx was here!!'
     p_elm = pList[2]
     paragraph = _Paragraph(p_elm, None)
     # exercise ---------------------
     paragraph.text = test_text
     # verify -----------------------
     assert len(paragraph.runs) == 1
     assert paragraph.runs[0].text == test_text
Beispiel #3
0
 def test_runs_size(self, pList):
     """_Paragraph.runs is expected size"""
     # setup ------------------------
     actual_lengths = []
     for p in pList:
         paragraph = _Paragraph(p, None)
         # exercise ----------------
         actual_lengths.append(len(paragraph.runs))
     # verify ------------------
     expected = [0, 0, 2, 1, 1, 1]
     actual = actual_lengths
     msg = "expected run count %s, got %s" % (expected, actual)
     assert actual == expected, msg
Beispiel #4
0
 def test_runs_size(self, pList):
     """_Paragraph.runs is expected size"""
     # setup ------------------------
     actual_lengths = []
     for p in pList:
         paragraph = _Paragraph(p, None)
         # exercise ----------------
         actual_lengths.append(len(paragraph.runs))
     # verify ------------------
     expected = [0, 0, 2, 1, 1, 1]
     actual = actual_lengths
     msg = "expected run count %s, got %s" % (expected, actual)
     assert actual == expected, msg
Beispiel #5
0
 def paragraph(self, p_bldr):
     return _Paragraph(p_bldr.element, None)
Beispiel #6
0
 def text_set_fixture(self, request):
     p_cxml, new_value, expected_p_cxml = request.param
     paragraph = _Paragraph(element(p_cxml), None)
     expected_xml = xml(expected_p_cxml)
     return paragraph, new_value, expected_xml
Beispiel #7
0
 def text_get_fixture(self, request):
     p_cxml, expected_value = request.param
     paragraph = _Paragraph(element(p_cxml), None)
     return paragraph, expected_value
Beispiel #8
0
 def runs_fixture(self):
     p_cxml = 'a:p/(a:r/a:t"Foo",a:r/a:t"Bar",a:r/a:t"Baz")'
     paragraph = _Paragraph(element(p_cxml), None)
     expected_text = ('Foo', 'Bar', 'Baz')
     return paragraph, expected_text
Beispiel #9
0
 def runs_fixture(self):
     p_cxml = 'a:p/(a:r/a:t"Foo",a:r/a:t"Bar",a:r/a:t"Baz")'
     paragraph = _Paragraph(element(p_cxml), None)
     expected_text = ('Foo', 'Bar', 'Baz')
     return paragraph, expected_text
Beispiel #10
0
 def paragraph_with_text(self, p_with_text):
     return _Paragraph(p_with_text, None)
Beispiel #11
0
 def paragraph_with_algn(self):
     pPr_bldr = a_pPr().with_algn('ctr')
     p_bldr = a_p().with_nsdecls().with_child(pPr_bldr)
     return _Paragraph(p_bldr.element, None)
Beispiel #12
0
 def paragraph(self, p_bldr):
     return _Paragraph(p_bldr.element, None)
Beispiel #13
0
 def text_set_fixture(self, request):
     p_cxml, new_value, expected_p_cxml = request.param
     paragraph = _Paragraph(element(p_cxml), None)
     expected_xml = xml(expected_p_cxml)
     return paragraph, new_value, expected_xml
Beispiel #14
0
 def text_get_fixture(self, request):
     p_cxml, expected_value = request.param
     paragraph = _Paragraph(element(p_cxml), None)
     return paragraph, expected_value
Beispiel #15
0
 def paragraph_with_algn(self):
     pPr_bldr = a_pPr().with_algn('ctr')
     p_bldr = a_p().with_nsdecls().with_child(pPr_bldr)
     return _Paragraph(p_bldr.element, None)
Beispiel #16
0
 def clear_fixture(self, request):
     p_cxml, expected_p_cxml = request.param
     paragraph = _Paragraph(element(p_cxml), None)
     expected_xml = xml(expected_p_cxml)
     return paragraph, expected_xml
Beispiel #17
0
 def paragraph_with_text(self, p_with_text):
     return _Paragraph(p_with_text, None)
Beispiel #18
0
 def clear_fixture(self, request):
     p_cxml, expected_p_cxml = request.param
     paragraph = _Paragraph(element(p_cxml), None)
     expected_xml = xml(expected_p_cxml)
     return paragraph, expected_xml