示例#1
0
    def it_removes_footer_part(self):
        document = Document(dir_pkg_path)
        document.remove_footers()

        for rel_id, part in document.part.related_parts.items():
            assert part.content_type != CT.WML_FOOTER

        footer_elm_tag = 'w:footerReference'
        sentinel_sectPr = document._body._body.get_or_add_sectPr()
        footer_elms = sentinel_sectPr.findall(qn(footer_elm_tag))
        assert len(footer_elms) == 0
示例#2
0
    def it_removes_footer_part(self):
        document = Document(dir_pkg_path)
        document.remove_footers()

        for rel_id, part in document.part.related_parts.items():
            assert part.content_type != CT.WML_FOOTER

        footer_elm_tag = "w:footerReference"
        sentinel_sectPr = document._body._body.get_or_add_sectPr()
        footer_elms = sentinel_sectPr.findall(qn(footer_elm_tag))
        assert len(footer_elms) == 0
示例#3
0
    def it_adds_to_doc_without_footer(self):
        document = Document(dir_pkg_path)
        document.remove_footers()

        footer = document.add_footer()
        footer_elm_tag = 'w:footerReference'
        sentinel_sectPr = document._body._body.get_or_add_sectPr()
        footer_elms = sentinel_sectPr.findall(qn(footer_elm_tag))
        assert len(footer_elms) == 1

        assert footer
        assert len(footer.paragraphs) == 0

        footer.add_paragraph('foobar')
        assert len(footer.paragraphs) == 1
示例#4
0
    def it_adds_to_doc_without_footer(self):
        document = Document(dir_pkg_path)
        document.remove_footers()

        footer = document.add_footer()
        footer_elm_tag = "w:footerReference"
        sentinel_sectPr = document._body._body.get_or_add_sectPr()
        footer_elms = sentinel_sectPr.findall(qn(footer_elm_tag))
        assert len(footer_elms) == 1

        assert footer
        assert len(footer.paragraphs) == 0

        footer.add_paragraph("foobar")
        assert len(footer.paragraphs) == 1