Commits

masklinn committed 142c22b

Makes more sense to convert bare JS objects to dicts than objects after all

Comments (0)

Files changed (2)

 
         switch(val.constructor) {
         case Object:
-            // 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;
+            return py.dict.fromJSON(val);
         case Array:
             return py.list.fromJSON(val);
         }
     });
 });
 describe('Type converter', function () {
-    it('should convert bare objects to objects', function () {
-        expect(py.eval('foo.bar', {foo: {bar: 3}})).to.be(3);
+    it('should convert bare objects to dicts', function () {
+        expect(py.eval('foo["bar"]', {foo: {bar: 3}})).to.be(3);
     });
 });