I want to do the following kind of test :
I ask students to write a class for Vector2D with 2 methods : one to add another vector and another one to multiply with a number (plus a constructor and a __str__ method).
So the good answer must be :
class Vecteur2D: def __init__(self,x,y): self.x = x self.y = y def __str__(self): return "[" + str(self.x) + "," + str(self.y) + "]" def multScalaire(self,s): self.x = self.x * s self.y = self.y * s def addVecteur(self,v): self.x = self.x + v.x self.y = self.y + v.yI want to give some points to students who manage to write the __init__ and __str__ methods, even if they can't write the multScalaire and addVecteur methods.
So, I configure my question like this :
and the same for 3 more tests :
the second one with only the multScalaire method
v1 = Vecteur2D(7,3)
the third one with the addVecteur method and the last one with all the methods.
When I test this question, if I answer with all but the multScalaire method, the first AND the third one should be OK but I get this :
Why does the second test (with multScalaire method) block the execution of the third test (which should be OK and add some points to the student)?