X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/4e329824f40367945de11d3647396859092f5c2c..b1376392167c09775bf57b41cb9ea3016f06cfb8:/tests/test_pdf.py?ds=inline diff --git a/tests/test_pdf.py b/tests/test_pdf.py index 98d1fa6..902bcf1 100644 --- a/tests/test_pdf.py +++ b/tests/test_pdf.py @@ -1,27 +1,25 @@ -# -*- coding: utf-8 -*- -# # This file is part of Librarian, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# Copyright © Fundacja Wolne Lektury. See NOTICE for more information. # -from __future__ import unicode_literals - import re from tempfile import NamedTemporaryFile -from nose.tools import * +import unittest from librarian import DirDocProvider from librarian.parser import WLDocument from .utils import get_fixture -def test_transform(): - temp = NamedTemporaryFile(delete=False) - temp.close() - WLDocument.from_file( +class PdfTests(unittest.TestCase): + def test_transform(self): + temp = NamedTemporaryFile(delete=False) + temp.close() + WLDocument.from_file( get_fixture('text', 'asnyk_zbior.xml'), provider=DirDocProvider(get_fixture('text', '')) ).as_pdf(save_tex=temp.name) - tex = open(temp.name, 'rb').read().decode('utf-8') + with open(temp.name, 'rb') as f: + tex = f.read().decode('utf-8') - # Check contributor list. - editors = re.search(r'\\def\\editors\{Opracowanie redakcyjne i przypisy: ([^}]*?)\.\s*\}', tex) - assert_equal(editors.group(1), u"Adam Fikcyjny, Aleksandra Sekuła, Olga Sutkowska") + # Check contributor list. + editors = re.search(r'\\def\\editors\{Opracowanie redakcyjne i przypisy: ([^}]*?)\.\s*\}', tex) + self.assertEqual(editors.group(1), "Adam Fikcyjny, Aleksandra Sekuła, Olga Sutkowska")