[gtk-doc] tests: mkhtml2: update test for chunking



commit f871f34b721a073f15888eef3506adca22d95fc5
Author: Stefan Sauer <ensonic users sf net>
Date:   Wed Apr 25 20:42:57 2018 +0200

    tests: mkhtml2: update test for chunking
    
    Add logging setup to make debugging easier.

 tests/mkhtml2.py |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/tests/mkhtml2.py b/tests/mkhtml2.py
index 3d86611..c65df80 100755
--- a/tests/mkhtml2.py
+++ b/tests/mkhtml2.py
@@ -18,6 +18,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 
+import logging
 import unittest
 
 from lxml import etree
@@ -27,26 +28,37 @@ from gtkdoc import mkhtml2
 
 class TestChunking(unittest.TestCase):
 
+    def setUp(self):
+        logging.basicConfig(
+            level=logging.INFO,
+            format='%(asctime)s:%(filename)s:%(funcName)s:%(lineno)d:%(levelname)s:%(message)s')
+
     def test_chunk_only_root_gives_single_chunk(self):
         root = etree.XML('<book />')
-        files = mkhtml2.chunk(root)
+        files = mkhtml2.chunk(root, 'test')
         self.assertEqual('book', files.name)
         self.assertEqual(0, len(files.descendants))
 
     def test_chunk_single_chapter_gives_two_chunks(self):
         root = etree.XML('<book><chapter /></book>')
-        files = mkhtml2.chunk(root)
-        self.assertEqual(1, len(files.descendants))
+        files = mkhtml2.chunk(root, 'test')
+        descendants = [f for f in files.descendants if f.anchor is None]
+        logging.info('descendants : %s', str(descendants))
+        self.assertEqual(1, len(descendants))
 
     def test_chunk_first_sect1_is_inlined(self):
         root = etree.XML('<book><chapter><sect1 /></chapter></book>')
-        files = mkhtml2.chunk(root)
-        self.assertEqual(1, len(files.descendants))
+        files = mkhtml2.chunk(root, 'test')
+        descendants = [f for f in files.descendants if f.anchor is None]
+        logging.info('descendants : %s', str(descendants))
+        self.assertEqual(1, len(descendants))
 
-    def test_chunk_second_sect1_is_nt_inlined(self):
+    def test_chunk_second_sect1_is_not_inlined(self):
         root = etree.XML('<book><chapter><sect1 /><sect1 /></chapter></book>')
-        files = mkhtml2.chunk(root)
-        self.assertEqual(2, len(files.descendants))
+        files = mkhtml2.chunk(root, 'test')
+        descendants = [f for f in files.descendants if f.anchor is None]
+        logging.info('descendants : %s', str(descendants))
+        self.assertEqual(2, len(descendants))
 
 
 if __name__ == '__main__':


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]