SVN: zope.testing/branches/regebro-python3-reloaded/src/zope/testing/ More Python 3 test compatibility changes.

Lennart Regebro <[email protected]>
Newsgroups gmane.comp.web.zope.zope3.cvs
Message-ID <[email protected]>
Log message for revision 106360:
  More Python 3 test compatibility changes.
  

Changed:
  U   zope.testing/branches/regebro-python3-reloaded/src/zope/testing/formparser.txt
  U   zope.testing/branches/regebro-python3-reloaded/src/zope/testing/module.txt
  U   zope.testing/branches/regebro-python3-reloaded/src/zope/testing/setupstack.txt

-=-
Modified: zope.testing/branches/regebro-python3-reloaded/src/zope/testing/formparser.txt
===================================================================
--- zope.testing/branches/regebro-python3-reloaded/src/zope/testing/formparser.txt	2009-12-09 22:14:15 UTC (rev 106359)
+++ zope.testing/branches/regebro-python3-reloaded/src/zope/testing/formparser.txt	2009-12-09 22:22:56 UTC (rev 106360)
@@ -104,8 +104,8 @@
 represent each instance of the field::
 
   >>> field = forms[1]["multi"]
-  >>> type(field)
-  <type 'list'>
+  >>> isinstance(field, list)
+  True
   >>> [o.value for o in field]
   ['', '']
   >>> [o.size for o in field]

Modified: zope.testing/branches/regebro-python3-reloaded/src/zope/testing/module.txt
===================================================================
--- zope.testing/branches/regebro-python3-reloaded/src/zope/testing/module.txt	2009-12-09 22:14:15 UTC (rev 106359)
+++ zope.testing/branches/regebro-python3-reloaded/src/zope/testing/module.txt	2009-12-09 22:22:56 UTC (rev 106360)
@@ -8,9 +8,13 @@
   >>> class Foo(object):
   ...    pass
 
-  >>> Foo.__module__
-  '__builtin__'
+  >>> 'builtin' in Foo.__module__
+  True
 
+(The test above looks like that, because the module is called '__builtin__'
+in Python 2, but 'builtins' in Python 3. Hence that weird test to make it
+work in both).
+
 By using ``zope.testing.module.setUp`` this can be
 controlled. Normally you set up your tests with it, but in this case
 we'll just call it manually.
@@ -48,8 +52,8 @@
 
   >>> class Foo(object):
   ...    pass
-  >>> Foo.__module__
-  '__builtin__'
+  >>> 'builtin' in Foo.__module__
+  True
 
 Importing
 ---------

Modified: zope.testing/branches/regebro-python3-reloaded/src/zope/testing/setupstack.txt
===================================================================
--- zope.testing/branches/regebro-python3-reloaded/src/zope/testing/setupstack.txt	2009-12-09 22:14:15 UTC (rev 106359)
+++ zope.testing/branches/regebro-python3-reloaded/src/zope/testing/setupstack.txt	2009-12-09 22:22:56 UTC (rev 106360)
@@ -76,7 +76,7 @@
 
 We can create files to out heart's content:
 
-    >>> open('Data.fs', 'w').write('xxx')
+    >>> dummy = open('Data.fs', 'w').write('xxx')
     >>> os.path.exists('Data.fs')
     True
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.