mkhtml2: if linkend does not resolve output inner data
[gtk-doc.git] / tests / mkhtml2.py
blob3d866111942a665feeeab10d0541abaea8a25459
1 # -*- python; coding: utf-8 -*-
3 # gtk-doc - GTK DocBook documentation generator.
4 # Copyright (C) 2018 Stefan Sauer
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 import unittest
23 from lxml import etree
25 from gtkdoc import mkhtml2
28 class TestChunking(unittest.TestCase):
30 def test_chunk_only_root_gives_single_chunk(self):
31 root = etree.XML('<book />')
32 files = mkhtml2.chunk(root)
33 self.assertEqual('book', files.name)
34 self.assertEqual(0, len(files.descendants))
36 def test_chunk_single_chapter_gives_two_chunks(self):
37 root = etree.XML('<book><chapter /></book>')
38 files = mkhtml2.chunk(root)
39 self.assertEqual(1, len(files.descendants))
41 def test_chunk_first_sect1_is_inlined(self):
42 root = etree.XML('<book><chapter><sect1 /></chapter></book>')
43 files = mkhtml2.chunk(root)
44 self.assertEqual(1, len(files.descendants))
46 def test_chunk_second_sect1_is_nt_inlined(self):
47 root = etree.XML('<book><chapter><sect1 /><sect1 /></chapter></book>')
48 files = mkhtml2.chunk(root)
49 self.assertEqual(2, len(files.descendants))
52 if __name__ == '__main__':
53 unittest.main()