[py-svn] r37297 - py/trunk/py/apigen/testing

guido at codespeak.net guido at codespeak.net
Wed Jan 24 22:04:20 CET 2007


Author: guido
Date: Wed Jan 24 22:04:18 2007
New Revision: 37297

Modified:
   py/trunk/py/apigen/testing/test_apigen_example.py
Log:
Fixed dependency on order in the function argument formatting tests.


Modified: py/trunk/py/apigen/testing/test_apigen_example.py
==============================================================================
--- py/trunk/py/apigen/testing/test_apigen_example.py	(original)
+++ py/trunk/py/apigen/testing/test_apigen_example.py	Wed Jan 24 22:04:18 2007
@@ -127,16 +127,25 @@
         snippet = apb.build_callable_view('main.sub.func')
         html = snippet.unicode()
         print html
-        run_string_sequence_test(html, [
-            'arg1 : AnyOf(',
-            'href="',
-            'Class SomeClass',
-            'Int>',
-            'return value:',
-            '<None>',
-            'source: %s' % (self.fs_root.join('pkg/func.py'),),
-            'def func(arg1):',
-        ])
+        # XXX somewhat grokky tests because the order of the items may change
+        assert 'arg1: AnyOf(' in html
+        pos1 = html.find('arg1: AnyOf(')
+        assert pos1 > -1
+        pos2 = html.find('href="', pos1)
+        assert pos2 > pos1
+        pos3 = html.find('Class SomeClass', pos2)
+        assert pos3 > pos2
+        pos4 = html.find('Int>', pos1)
+        assert pos4 > pos1
+        pos5 = html.find('return value:', pos4)
+        assert pos5 > pos4 and pos5 > pos3
+        pos6 = html.find('<None>', pos5)
+        assert pos6 > pos5
+        pos7 = html.find('source: %s' % (self.fs_root.join('pkg/func.py'),),
+                          pos6)
+        assert pos7 > pos6
+        pos8 = html.find('def func(arg1):', pos7)
+        assert pos8 > pos7
         _checkhtmlsnippet(html)
 
     def test_build_function_pages(self):



More information about the pytest-commit mailing list