pypy / pypy / module / cpyext / test /

Diff from to


         w_class = space.appexec([], """():
             class C:
                 x = None
-                def __init__(self):
+                def __init__(self, *args, **kwargs):
                     self.x = 1
+                    self.args = args
+                    self.__dict__.update(kwargs)
             return C
         assert space.getattr(w_instance, space.wrap('x')) is space.w_None
         assert space.unwrap(space.getattr(w_instance, space.wrap('a'))) == 3
+        w_instance = api.PyInstance_New(w_class,
+                                        space.wrap((3,)), space.wrap(dict(y=2)))
+        assert space.unwrap(space.getattr(w_instance, space.wrap('x'))) == 1
+        assert space.unwrap(space.getattr(w_instance, space.wrap('y'))) == 2
+        assert space.unwrap(space.getattr(w_instance, space.wrap('args'))) == (3,)
     def test_lookup(self, space, api):
         w_instance = space.appexec([], """():
             class C:
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
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.