Commits

masklinn committed 5313409

Turns out it does *not* make more sense to convert JS Object to a py.dict after all

  • Participants
  • Parent commits 142c22b

Comments (0)

Files changed (2)

 
         switch(val.constructor) {
         case Object:
-            return py.dict.fromJSON(val);
+            // TODO: why py.object instead of py.dict?
+            var o = py.PY_call(py.object);
+            for (var prop in val) {
+                if (val.hasOwnProperty(prop)) {
+                    o[prop] = val[prop];
+                }
+            }
+            return o;
         case Array:
             return py.list.fromJSON(val);
         }

File test/test.js

     });
 });
 describe('Type converter', function () {
-    it('should convert bare objects to dicts', function () {
-        expect(py.eval('foo["bar"]', {foo: {bar: 3}})).to.be(3);
+    it('should convert bare objects to objects', function () {
+        expect(py.eval('foo.bar', {foo: {bar: 3}})).to.be(3);
     });
 });