1 # -*- coding: utf-8 -*-
3 # This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
4 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
6 from __future__ import unicode_literals
9 from unittest import TestCase
10 from librarian import NoDublinCore
11 from librarian.parser import WLDocument
12 from nose.tools import *
13 from .utils import get_fixture
16 class TransformTest(TestCase):
19 def test_transform(self):
20 expected_output_file_path = get_fixture('text', 'asnyk_miedzy_nami_expected.html')
22 html = WLDocument.from_file(
23 get_fixture('text', 'miedzy-nami-nic-nie-bylo.xml')
24 ).as_html().get_bytes().decode('utf-8')
26 self.assertEqual(html, io.open(expected_output_file_path).read())
30 def test_no_dublincore():
32 get_fixture('text', 'asnyk_miedzy_nami_nodc.xml')
36 def test_passing_parse_dublincore_to_transform():
37 """Passing parse_dublincore=False to transform omits DublinCore parsing."""
39 get_fixture('text', 'asnyk_miedzy_nami_nodc.xml'),
40 parse_dublincore=False,
45 assert not WLDocument.from_bytes(
47 parse_dublincore=False,