Dusty Phillips avatar Dusty Phillips committed a609f7a

Python 3 syntax changes in zpickle tests

Comments (0)

Files changed (1)

pypy/module/_continuation/test/test_zpickle.py

         assert lst4 == [co4]
 
     def test_copy_continulet_real(self):
-        import new, sys
-        mod = new.module('test_copy_continulet_real')
+        import types, sys
+        mod = types.ModuleType('test_copy_continulet_real')
         sys.modules['test_copy_continulet_real'] = mod
-        exec '''if 1:
+        exec('''if 1:
             from _continuation import continulet
             import copy
             def f(co, x):
             res = co.switch()
             assert res == 43
             assert not co.is_pending()
-        ''' in mod.__dict__
+        ''',  mod.__dict__)
 
     def test_copy_continulet_already_finished(self):
         from _continuation import continulet, error
         co = continulet.__new__(continulet)
         import pickle
         pckl = pickle.dumps(co, self.version)
-        print repr(pckl)
+        print(repr(pckl))
         co2 = pickle.loads(pckl)
         assert co2 is not co
         assert not co.is_pending()
         co.bar = 'baz'
         import pickle
         pckl = pickle.dumps(co, self.version)
-        print repr(pckl)
+        print(repr(pckl))
         co2 = pickle.loads(pckl)
         assert co2 is not co
         assert not co.is_pending()
         lst = []
         co = continulet(lst.append)
         pckl = pickle.dumps((co, lst))
-        print pckl
+        print(pckl)
         del co, lst
         for i in range(2):
-            print 'resume...'
+            print('resume...')
             co2, lst2 = pickle.loads(pckl)
             assert lst2 == []
             co2.switch()
             assert lst2 == [co2]
 
     def test_pickle_continulet_real(self):
-        import new, sys
-        mod = new.module('test_pickle_continulet_real')
+        import types, sys
+        mod = types.ModuleType('test_copy_continulet_real')
         sys.modules['test_pickle_continulet_real'] = mod
         mod.version = self.version
-        exec '''if 1:
+        exec('''if 1:
             from _continuation import continulet
             import pickle
             def f(co, x):
             res = co.switch()
             assert res == 41
             pckl = pickle.dumps(co, version)
-            print repr(pckl)
+            print(repr(pckl))
             co2 = pickle.loads(pckl)
             #
             res = co2.switch()
             res = co.switch()
             assert res == 43
             assert not co.is_pending()
-        ''' in mod.__dict__
+        ''', mod.__dict__)
 
     def test_pickle_continulet_real_subclass(self):
-        import new, sys
-        mod = new.module('test_pickle_continulet_real_subclass')
+        import types, sys
+        mod = types.ModuleType('test_copy_continulet_real_subclass')
         sys.modules['test_pickle_continulet_real_subclass'] = mod
         mod.version = self.version
-        exec '''if 1:
+        exec('''if 1:
             from _continuation import continulet
             import pickle
             class A(continulet):
             res = co.switch()
             assert res == 41
             pckl = pickle.dumps(co, version)
-            print repr(pckl)
+            print(repr(pckl))
             co2 = pickle.loads(pckl)
             #
             assert type(co2) is A
             res = co.switch()
             assert res == 43
             assert not co.is_pending()
-        ''' in mod.__dict__
+        ''', mod.__dict__)
 
 
 class AppTestPickle_v1(AppTestPickle):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.