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 librarian import html, NoDublinCore
7 from nose.tools import *
8 from utils import get_fixture, remove_output_file
10 def teardown_transform():
11 remove_output_file('text', 'asnyk_miedzy_nami.html')
14 @with_setup(None, teardown_transform)
16 output_file_path = get_fixture('text', 'asnyk_miedzy_nami.html')
17 expected_output_file_path = get_fixture('text', 'asnyk_miedzy_nami_expected.html')
20 get_fixture('text', 'asnyk_miedzy_nami.xml'),
24 assert_equal(file(output_file_path).read(), file(expected_output_file_path).read())
27 @with_setup(None, teardown_transform)
29 def test_no_dublincore():
31 get_fixture('text', 'asnyk_miedzy_nami_nodc.xml'),
32 get_fixture('text', 'asnyk_miedzy_nami_nodc.html'),
36 @with_setup(None, teardown_transform)
37 def test_passing_parse_dublincore_to_transform():
38 """Passing parse_dublincore=False to transform omits DublinCore parsing."""
40 get_fixture('text', 'asnyk_miedzy_nami_nodc.xml'),
41 get_fixture('text', 'asnyk_miedzy_nami.html'),
42 parse_dublincore=False,
46 assert html.transform('<utwor />', is_file=False, parse_dublincore=False).find('empty')