[epub, mobi] Paragraph indentation improvements plus support for initials in chapters
[librarian.git] / tests / test_html_fragments.py
1 # -*- coding: utf-8 -*-
2 #
3 # This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
4 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 #
6 from librarian.html import extract_fragments
7 from nose.tools import *
8 from utils import get_fixture
9
10
11 def test_fragments():
12     expected_output_file_path = get_fixture('text', 'asnyk_miedzy_nami_fragments.html')
13
14     closed_fragments, open_fragments = extract_fragments(
15         get_fixture('text', 'asnyk_miedzy_nami_expected.html'))
16     assert not open_fragments
17     fragments_text = u"\n\n".join(u"%s: %s\n%s" % (f.id, f.themes, f)
18                                     for f in closed_fragments.values())
19     assert_equal(fragments_text, file(expected_output_file_path).read().decode('utf-8'))
20