1 # This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
5 from tempfile import NamedTemporaryFile
7 from librarian import DirDocProvider
8 from librarian.parser import WLDocument
9 from .utils import get_fixture
12 class PdfTests(unittest.TestCase):
13 def test_transform(self):
14 temp = NamedTemporaryFile(delete=False)
17 get_fixture('text', 'asnyk_zbior.xml'),
18 provider=DirDocProvider(get_fixture('text', ''))
19 ).as_pdf(save_tex=temp.name)
20 with open(temp.name, 'rb') as f:
21 tex = f.read().decode('utf-8')
23 # Check contributor list.
24 editors = re.search(r'\\def\\editors\{Opracowanie redakcyjne i przypisy: ([^}]*?)\.\s*\}', tex)
25 self.assertEqual(editors.group(1), "Adam Fikcyjny, Aleksandra Sekuła, Olga Sutkowska")