Fix verse numbering.
[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 __future__ import unicode_literals
7
8 import unittest
9 from librarian.html import extract_fragments
10 from .utils import get_fixture
11
12
13 class FragmentsTest(unittest.TestCase):
14     maxDiff = None
15
16     def test_fragments(self):
17         expected_output_file_path = get_fixture('text', 'asnyk_miedzy_nami_fragments.html')
18
19         closed_fragments, open_fragments = extract_fragments(
20             get_fixture('text', 'asnyk_miedzy_nami_expected.html'))
21         assert not open_fragments
22         fragments_text = u"\n\n".join(u"%s: %s\n%s" % (f.id, f.themes, f) for f in sorted(closed_fragments.values(), key=lambda f: f.id))
23         self.assertEqual(fragments_text, open(expected_output_file_path, 'rb').read().decode('utf-8'))