[gobject-introspection] tests: put create_tests() below TestCommentBlock()



commit 94a7d4b4af283bf46b81411699f10ffcf3937a29
Author: Dieter Verfaillie <dieterv optionexplicit be>
Date:   Wed May 15 13:54:07 2013 +0200

    tests: put create_tests() below TestCommentBlock()
    
    closer to __main__, where it's actually used...

 tests/scanner/annotationparser/test_parser.py |   40 ++++++++++++------------
 1 files changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/tests/scanner/annotationparser/test_parser.py b/tests/scanner/annotationparser/test_parser.py
index 6bf3ef3..4e03c51 100644
--- a/tests/scanner/annotationparser/test_parser.py
+++ b/tests/scanner/annotationparser/test_parser.py
@@ -37,26 +37,6 @@ from giscanner.ast import Namespace
 from giscanner.message import MessageLogger
 
 
-def create_tests(tests_dir, tests_file):
-    tests_name = os.path.relpath(tests_file[:-4], tests_dir)
-    tests_name = tests_name.replace('/', '.').replace('\\', '.')
-
-    tests_tree = etree.parse(tests_file).getroot()
-
-    fix_cdata_elements = tests_tree.findall('test/commentblock')
-    fix_cdata_elements += tests_tree.findall('.//description')
-
-    for element in fix_cdata_elements:
-        if element.text:
-            element.text = element.text.replace('{{?', '<!')
-            element.text = element.text.replace('}}', '>')
-
-    for counter, test in enumerate(tests_tree.findall('test')):
-        test_name = 'test_%s.%03d' % (tests_name, counter + 1)
-        test_method = TestCommentBlock.__create_test__(test)
-        setattr(TestCommentBlock, test_name, test_method)
-
-
 class TestCommentBlock(unittest.TestCase):
     @classmethod
     def __create_test__(cls, testcase):
@@ -275,6 +255,26 @@ class TestCommentBlock(unittest.TestCase):
         return expected
 
 
+def create_tests(tests_dir, tests_file):
+    tests_name = os.path.relpath(tests_file[:-4], tests_dir)
+    tests_name = tests_name.replace('/', '.').replace('\\', '.')
+
+    tests_tree = etree.parse(tests_file).getroot()
+
+    fix_cdata_elements = tests_tree.findall('test/commentblock')
+    fix_cdata_elements += tests_tree.findall('.//description')
+
+    for element in fix_cdata_elements:
+        if element.text:
+            element.text = element.text.replace('{{?', '<!')
+            element.text = element.text.replace('}}', '>')
+
+    for counter, test in enumerate(tests_tree.findall('test')):
+        test_name = 'test_%s.%03d' % (tests_name, counter + 1)
+        test_method = TestCommentBlock.__create_test__(test)
+        setattr(TestCommentBlock, test_name, test_method)
+
+
 if __name__ == '__main__':
     # Initialize message logger
     # TODO: at some point it might be a good idea to test warnings emitted


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