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
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
def paragraph(self, p_bldr): return _Paragraph(p_bldr.element, None)
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
def text_get_fixture(self, request): p_cxml, expected_value = request.param paragraph = _Paragraph(element(p_cxml), None) return paragraph, expected_value
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
def paragraph_with_text(self, p_with_text): return _Paragraph(p_with_text, None)
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)
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