Fixes #3031: Sponsor info in PDF.
[librarian.git] / tests / test_text.py
1 # -*- coding: utf-8 -*-
2 #
3 # This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
4 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 #
6 from librarian import NoDublinCore
7 from librarian.parser import WLDocument
8 from nose.tools import *
9 from utils import get_fixture
10
11
12 def test_transform():
13     expected_output_file_path = get_fixture('text', 'asnyk_miedzy_nami_expected.txt')
14
15     text = WLDocument.from_file(
16             get_fixture('text', 'miedzy-nami-nic-nie-bylo.xml')
17         ).as_text().get_string()
18
19     assert_equal(text, file(expected_output_file_path).read())
20
21
22 @raises(NoDublinCore)
23 def test_no_dublincore():
24     WLDocument.from_file(
25             get_fixture('text', 'asnyk_miedzy_nami_nodc.xml')
26         ).as_text()
27
28
29 def test_passing_parse_dublincore_to_transform():
30     """Passing parse_dublincore=False to the constructor omits DublinCore parsing."""
31     WLDocument.from_file(
32             get_fixture('text', 'asnyk_miedzy_nami_nodc.xml'),
33             parse_dublincore=False,
34         ).as_text()