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 librarian.builders import builders
6 from librarian.document import WLDocument
7 from .utils import get_fixture
10 class TextTests(unittest.TestCase):
13 def test_transform(self):
14 expected_output_file_path = get_fixture('text', 'asnyk_miedzy_nami_expected.txt')
17 filename=get_fixture('text', 'miedzy-nami-nic-nie-bylo.xml')
18 ).build(builders['txt']).get_bytes().decode('utf-8')
20 with open(expected_output_file_path, 'rb') as f:
21 self.assertEqual(text, f.read().decode('utf-8'))
24 def test_transform_raw(self):
25 expected_output_file_path = get_fixture('text', 'asnyk_miedzy_nami_expected_raw.txt')
28 filename=get_fixture('text', 'miedzy-nami-nic-nie-bylo.xml')
29 ).build(builders['txt'], raw_text=True).get_bytes().decode('utf-8')
31 with open(expected_output_file_path, 'rb') as f:
32 self.assertEqual(text, f.read().decode('utf-8'))