def can_overwrite_existing_style_map():
    fileobj = _normal_docx()
    write_style_map(fileobj, "p => h1")
    write_style_map(fileobj, "p => h2")
    with open_zip(fileobj, "r") as zip_file:
        assert_equal("p => h2", read_style_map(fileobj))
        _assert_no_duplicates(zip_file._zip_file.namelist())
        assert_equal(expected_relationships_xml, _read_relationships_xml(fileobj))
        assert_equal(expected_content_types_xml, _read_content_types_xml(fileobj))
Esempio n. 2
0
def can_overwrite_existing_style_map():
    fileobj = _normal_docx()
    write_style_map(fileobj, "p => h1")
    write_style_map(fileobj, "p => h2")
    with open_zip(fileobj, "r") as zip_file:
        assert_equal("p => h2", read_style_map(fileobj))
        _assert_no_duplicates(zip_file._zip_file.namelist())
        assert_equal(expected_relationships_xml,
                     _read_relationships_xml(fileobj))
        assert_equal(expected_content_types_xml,
                     _read_content_types_xml(fileobj))
def embedded_style_map_has_override_content_type_in_content_types_xml():
    fileobj = _normal_docx()
    write_style_map(fileobj, "p => h1")
    assert_equal(expected_content_types_xml, _read_content_types_xml(fileobj))
def embedded_style_map_is_referenced_in_relationships():
    fileobj = _normal_docx()
    write_style_map(fileobj, "p => h1")
    assert_equal(expected_relationships_xml, _read_relationships_xml(fileobj))
def embedded_style_map_is_written_to_separate_file():
    fileobj = _normal_docx()
    write_style_map(fileobj, "p => h1")
    with open_zip(fileobj, "r") as zip_file:
        assert_equal("p => h1", zip_file.read_str("mammoth/style-map"))
def embedded_style_map_can_be_read_after_being_written():
    fileobj = _normal_docx()
    write_style_map(fileobj, "p => h1")
    assert_equal("p => h1", read_style_map(fileobj))
def writing_style_map_preserves_unrelated_files():
    fileobj = _normal_docx()
    write_style_map(fileobj, "p => h1")
    with open_zip(fileobj, "r") as zip_file:
        assert_equal("placeholder", zip_file.read_str("placeholder"))
Esempio n. 8
0
def embedded_style_map_has_override_content_type_in_content_types_xml():
    fileobj = _normal_docx()
    write_style_map(fileobj, "p => h1")
    assert_equal(expected_content_types_xml, _read_content_types_xml(fileobj))
Esempio n. 9
0
def embedded_style_map_is_referenced_in_relationships():
    fileobj = _normal_docx()
    write_style_map(fileobj, "p => h1")
    assert_equal(expected_relationships_xml, _read_relationships_xml(fileobj))
Esempio n. 10
0
def embedded_style_map_is_written_to_separate_file():
    fileobj = _normal_docx()
    write_style_map(fileobj, "p => h1")
    with open_zip(fileobj, "r") as zip_file:
        assert_equal("p => h1", zip_file.read_str("mammoth/style-map"))
Esempio n. 11
0
def embedded_style_map_can_be_read_after_being_written():
    fileobj = _normal_docx()
    write_style_map(fileobj, "p => h1")
    assert_equal("p => h1", read_style_map(fileobj))
Esempio n. 12
0
def writing_style_map_preserves_unrelated_files():
    fileobj = _normal_docx()
    write_style_map(fileobj, "p => h1")
    with open_zip(fileobj, "r") as zip_file:
        assert_equal("placeholder", zip_file.read_str("placeholder"))