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'))
 
  15         hb = builders['html']()
 
  16         hb.assign_ids(doc.tree)
 
  19         for ref in doc.references():
 
  20             snippet = ref.get_snippet()
 
  21             b = builders['html-snippet']()
 
  28                     b.output().get_bytes().decode('utf-8')
 
  31         output = '\n\n'.join(refs)
 
  32         with open(get_fixture('text', 'asnyk_miedzy_nami_refs.html')) as f:
 
  33             self.assertEqual(output, f.read())