chiark / gitweb /
doxygen: expected is *second* in the assertSomething() functions.
authorVladimír Vondruš <mosra@centrum.cz>
Sat, 9 Dec 2017 21:44:06 +0000 (22:44 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Mon, 11 Dec 2017 01:48:25 +0000 (02:48 +0100)
doxygen/test/__init__.py
doxygen/test/test_compound.py
doxygen/test/test_contents.py
doxygen/test/test_page.py

index 6179f295b82edfbfc302fb4231cfaa6c00f62f38..1ec23d5f62ac92dfb8b7f4bd7939042c5336617a 100644 (file)
@@ -24,9 +24,11 @@ class IntegrationTestCase(unittest.TestCase):
     def run_dox2html5(self, templates=default_templates, wildcard=default_wildcard, index_pages=default_index_pages):
         run(os.path.join(self.path, 'Doxyfile'), templates=templates, wildcard=wildcard, index_pages=index_pages)
 
-    def expected_actual_contents(self, file):
-        with open(os.path.join(self.path, file)) as f:
-            expected = f.read().strip()
-        with open(os.path.join(self.path, 'html', file)) as f:
-            actual = f.read().strip()
-        return expected, actual
+    def actual_expected_contents(self, actual, expected = None):
+        if not expected: expected = actual
+
+        with open(os.path.join(self.path, expected)) as f:
+            expected_contents = f.read().strip()
+        with open(os.path.join(self.path, 'html', actual)) as f:
+            actual_contents = f.read().strip()
+        return actual_contents, expected_contents
index de5490ba95fb10271213c4628870214f386dfe1f..971125f992eb0526fc9261d579e2f1effdbd850b 100644 (file)
@@ -9,22 +9,22 @@ class Listing(IntegrationTestCase):
 
     def test_index_pages(self):
         self.run_dox2html5(wildcard='index.xml', index_pages=['annotated', 'namespaces'])
-        self.assertEqual(*self.expected_actual_contents('annotated.html'))
-        self.assertEqual(*self.expected_actual_contents('namespaces.html'))
+        self.assertEqual(*self.actual_expected_contents('annotated.html'))
+        self.assertEqual(*self.actual_expected_contents('namespaces.html'))
 
     def test_index_pages_custom_expand_level(self):
         self.run_dox2html5(wildcard='index.xml', index_pages=['files'])
-        self.assertEqual(*self.expected_actual_contents('files.html'))
+        self.assertEqual(*self.actual_expected_contents('files.html'))
 
     def test_dir(self):
         self.run_dox2html5(wildcard='dir_*.xml')
-        self.assertEqual(*self.expected_actual_contents('dir_4b0d5f8864bf89936129251a2d32609b.html'))
-        self.assertEqual(*self.expected_actual_contents('dir_bbe5918fe090eee9db2d9952314b6754.html'))
+        self.assertEqual(*self.actual_expected_contents('dir_4b0d5f8864bf89936129251a2d32609b.html'))
+        self.assertEqual(*self.actual_expected_contents('dir_bbe5918fe090eee9db2d9952314b6754.html'))
 
     def test_file(self):
         self.run_dox2html5(wildcard='*_8h.xml')
-        self.assertEqual(*self.expected_actual_contents('File_8h.html'))
-        self.assertEqual(*self.expected_actual_contents('Class_8h.html'))
+        self.assertEqual(*self.actual_expected_contents('File_8h.html'))
+        self.assertEqual(*self.actual_expected_contents('Class_8h.html'))
 
     @unittest.expectedFailure
     def test_empty_file_doc_not_generated(self):
@@ -33,15 +33,15 @@ class Listing(IntegrationTestCase):
 
     def test_namespace(self):
         self.run_dox2html5(wildcard='namespaceRoot_1_1Directory.xml')
-        self.assertEqual(*self.expected_actual_contents('namespaceRoot_1_1Directory.html'))
+        self.assertEqual(*self.actual_expected_contents('namespaceRoot_1_1Directory.html'))
 
     def test_namespace_empty(self):
         self.run_dox2html5(wildcard='namespaceAnother.xml')
-        self.assertEqual(*self.expected_actual_contents('namespaceAnother.html'))
+        self.assertEqual(*self.actual_expected_contents('namespaceAnother.html'))
 
     def test_class(self):
         self.run_dox2html5(wildcard='classRoot_1_1Directory_1_1Sub_1_1Class.xml')
-        self.assertEqual(*self.expected_actual_contents('classRoot_1_1Directory_1_1Sub_1_1Class.html'))
+        self.assertEqual(*self.actual_expected_contents('classRoot_1_1Directory_1_1Sub_1_1Class.html'))
 
     @unittest.expectedFailure
     def test_empty_class_doc_not_generated(self):
@@ -50,11 +50,11 @@ class Listing(IntegrationTestCase):
 
     def test_page_toc(self):
         self.run_dox2html5(wildcard='page-toc.xml')
-        self.assertEqual(*self.expected_actual_contents('page-toc.html'))
+        self.assertEqual(*self.actual_expected_contents('page-toc.html'))
 
     def test_page_no_toc(self):
         self.run_dox2html5(wildcard='page-no-toc.xml')
-        self.assertEqual(*self.expected_actual_contents('page-no-toc.html'))
+        self.assertEqual(*self.actual_expected_contents('page-no-toc.html'))
 
 class Detailed(IntegrationTestCase):
     def __init__(self, *args, **kwargs):
@@ -62,40 +62,40 @@ class Detailed(IntegrationTestCase):
 
     def test_namespace(self):
         self.run_dox2html5(wildcard='namespaceNamee.xml')
-        self.assertEqual(*self.expected_actual_contents('namespaceNamee.html'))
+        self.assertEqual(*self.actual_expected_contents('namespaceNamee.html'))
 
     def test_class_template(self):
         self.run_dox2html5(wildcard='structTemplate.xml')
-        self.assertEqual(*self.expected_actual_contents('structTemplate.html'))
+        self.assertEqual(*self.actual_expected_contents('structTemplate.html'))
 
     def test_class_template_specialized(self):
         self.run_dox2html5(wildcard='structTemplate_3_01void_01_4.xml')
-        self.assertEqual(*self.expected_actual_contents('structTemplate_3_01void_01_4.html'))
+        self.assertEqual(*self.actual_expected_contents('structTemplate_3_01void_01_4.html'))
 
     def test_class_template_warnings(self):
         self.run_dox2html5(wildcard='structTemplateWarning.xml')
-        self.assertEqual(*self.expected_actual_contents('structTemplateWarning.html'))
+        self.assertEqual(*self.actual_expected_contents('structTemplateWarning.html'))
 
     def test_function(self):
         self.run_dox2html5(wildcard='namespaceFoo.xml')
-        self.assertEqual(*self.expected_actual_contents('namespaceFoo.html'))
+        self.assertEqual(*self.actual_expected_contents('namespaceFoo.html'))
 
     def test_enum(self):
         self.run_dox2html5(wildcard='namespaceEno.xml')
-        self.assertEqual(*self.expected_actual_contents('namespaceEno.html'))
+        self.assertEqual(*self.actual_expected_contents('namespaceEno.html'))
 
     def test_function_enum_warnings(self):
         self.run_dox2html5(wildcard='namespaceWarning.xml')
-        self.assertEqual(*self.expected_actual_contents('namespaceWarning.html'))
+        self.assertEqual(*self.actual_expected_contents('namespaceWarning.html'))
 
     def test_typedef(self):
         self.run_dox2html5(wildcard='namespaceType.xml')
-        self.assertEqual(*self.expected_actual_contents('namespaceType.html'))
+        self.assertEqual(*self.actual_expected_contents('namespaceType.html'))
 
     def test_var(self):
         self.run_dox2html5(wildcard='namespaceVar.xml')
-        self.assertEqual(*self.expected_actual_contents('namespaceVar.html'))
+        self.assertEqual(*self.actual_expected_contents('namespaceVar.html'))
 
     def test_define(self):
         self.run_dox2html5(wildcard='File_8h.xml')
-        self.assertEqual(*self.expected_actual_contents('File_8h.html'))
+        self.assertEqual(*self.actual_expected_contents('File_8h.html'))
index ad1410a9ad30af29261f35da555acd896ccb088d..deba4b8a058cdb6b7b000c8d031df6b4a7085d28 100644 (file)
@@ -8,11 +8,11 @@ class Typography(IntegrationTestCase):
 
     def test(self):
         self.run_dox2html5(wildcard='indexpage.xml')
-        self.assertEqual(*self.expected_actual_contents('index.html'))
+        self.assertEqual(*self.actual_expected_contents('index.html'))
 
     def test_warnings(self):
         self.run_dox2html5(wildcard='warnings.xml')
-        self.assertEqual(*self.expected_actual_contents('warnings.html'))
+        self.assertEqual(*self.actual_expected_contents('warnings.html'))
 
 class Blocks(IntegrationTestCase):
     def __init__(self, *args, **kwargs):
@@ -20,11 +20,11 @@ class Blocks(IntegrationTestCase):
 
     def test(self):
         self.run_dox2html5(wildcard='indexpage.xml')
-        self.assertEqual(*self.expected_actual_contents('index.html'))
+        self.assertEqual(*self.actual_expected_contents('index.html'))
 
     def test_xrefpages(self):
         self.run_dox2html5(wildcard='todo.xml')
-        self.assertEqual(*self.expected_actual_contents('todo.html'))
+        self.assertEqual(*self.actual_expected_contents('todo.html'))
 
 class Code(IntegrationTestCase):
     def __init__(self, *args, **kwargs):
@@ -32,11 +32,11 @@ class Code(IntegrationTestCase):
 
     def test(self):
         self.run_dox2html5(wildcard='indexpage.xml')
-        self.assertEqual(*self.expected_actual_contents('index.html'))
+        self.assertEqual(*self.actual_expected_contents('index.html'))
 
     def test_warnings(self):
         self.run_dox2html5(wildcard='warnings.xml')
-        self.assertEqual(*self.expected_actual_contents('warnings.html'))
+        self.assertEqual(*self.actual_expected_contents('warnings.html'))
 
 class Image(IntegrationTestCase):
     def __init__(self, *args, **kwargs):
@@ -44,12 +44,12 @@ class Image(IntegrationTestCase):
 
     def test(self):
         self.run_dox2html5(wildcard='indexpage.xml')
-        self.assertEqual(*self.expected_actual_contents('index.html'))
+        self.assertEqual(*self.actual_expected_contents('index.html'))
         self.assertTrue(os.path.exists(os.path.join(self.path, 'html', 'tiny.png')))
 
     def test_warnings(self):
         self.run_dox2html5(wildcard='warnings.xml')
-        self.assertEqual(*self.expected_actual_contents('warnings.html'))
+        self.assertEqual(*self.actual_expected_contents('warnings.html'))
 
 class Math(IntegrationTestCase):
     def __init__(self, *args, **kwargs):
@@ -57,7 +57,7 @@ class Math(IntegrationTestCase):
 
     def test(self):
         self.run_dox2html5(wildcard='indexpage.xml')
-        self.assertEqual(*self.expected_actual_contents('index.html'))
+        self.assertEqual(*self.actual_expected_contents('index.html'))
 
 class Tagfile(IntegrationTestCase):
     def __init__(self, *args, **kwargs):
@@ -65,4 +65,4 @@ class Tagfile(IntegrationTestCase):
 
     def test(self):
         self.run_dox2html5(wildcard='indexpage.xml')
-        self.assertEqual(*self.expected_actual_contents('index.html'))
+        self.assertEqual(*self.actual_expected_contents('index.html'))
index 37273b2a15f111b16d891cea2c33e8cb62f4c492..b4cf416b24c8010ce0f575e663b0b224df20dc37 100644 (file)
@@ -6,7 +6,7 @@ class Order(IntegrationTestCase):
 
     def test(self):
         self.run_dox2html5(index_pages=['pages'], wildcard='index.xml')
-        self.assertEqual(*self.expected_actual_contents('pages.html'))
+        self.assertEqual(*self.actual_expected_contents('pages.html'))
 
 class DuplicatedBrief(IntegrationTestCase):
     def __init__(self, *args, **kwargs):
@@ -14,5 +14,5 @@ class DuplicatedBrief(IntegrationTestCase):
 
     def test(self):
         self.run_dox2html5(wildcard='page-*.xml')
-        self.assertEqual(*self.expected_actual_contents('page-a.html'))
-        self.assertEqual(*self.expected_actual_contents('page-b.html'))
+        self.assertEqual(*self.actual_expected_contents('page-a.html'))
+        self.assertEqual(*self.actual_expected_contents('page-b.html'))