1 # This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
4 from unittest import TestCase
5 from librarian.builders import builders
6 from librarian.document import WLDocument
7 from tests.utils import get_fixture
11 class RefTests(TestCase):
12 def test_snippet(self):
13 doc = WLDocument(filename=get_fixture('text', 'miedzy-nami-nic-nie-bylo.xml'))
14 doc._compat_assign_section_ids()
17 for ref in doc.references():
18 snippet = ref.get_snippet()
19 b = builders['html']()
26 b.output().get_bytes().decode('utf-8')
29 output = '\n\n'.join(refs)
30 with open(get_fixture('text', 'asnyk_miedzy_nami_refs.html')) as f:
31 self.assertEqual(output, f.read())