1. Lucian Brănescu-Mihăilă
  2. puffin

Commits

Lucian Brănescu-Mihăilă  committed 5a7abaf

Add failure tests. Small cleanups.

  • Participants
  • Parent commits 6229880
  • Branches default

Comments (0)

Files changed (4)

File objects/src/instance.winxed

View file
     function invoke[vtable](var p [slurpy], var n [slurpy,named]) {
         var sub = self.__call__; 
 
+        if(sub == null)
+            throw 'TypeError';
+
         // if sub is a parrot Sub, it'll get executed
         // if sub is an instance with __call__, this invoke will get called,
         //   all the way down to a Sub somewhere

File objects/src/type.winxed

View file
                 var attr = i.__dict__[key];
    
                 // only for python objects
-                if(typeof(attr) == 'Python;instance') {
+                if(typeof(attr) == 'Python;instance')
                     // if data-descriptor
                     if(exists attr.__dict__['__get__'] && exists attr.__dict__['__set__']) {
                         cry('using data descriptor');
                         return attr.__dict__['__get__'](attr, obj);
                     }
-                }
             }
         }
 

File objects/t/instance.t

View file
         self.assert.equal(i(), 42);
     }
 
+    function call_class_fail() {
+        var i = new Python.instance;
+
+        self.assert.throws('TypeError', function(){
+            i();
+        });
+    }
+
     function call_instance() {
         var c = new Python.instance;
         var i = new Python.instance;

File objects/t/typeobject.t

View file
         :(var t, var o) = boot();
 
         self.assert.throws('AttributeError', function() {
-            var a = t.bla;
+            var a = o.bla;
         });
     }