Re: [Tutor] unittest for: Raises an exception

2015-02-19 Thread Sydney Shall
On 18/02/2015 20:40, Ben Finney wrote: Sydney Shall writes: My test code is the following: def test_func_getSurplusLabourTime_Exc(self): self.assertRaises(ValueError,self.cwp.getSurplusLabourTime(self.cwp.ww,self.cwp.uvc)) [This last line should indented, but it refuses to do so!] What is

Re: [Tutor] unittest for: Raises an exception

2015-02-18 Thread Ben Finney
Sydney Shall writes: > My test code is the following: > > def test_func_getSurplusLabourTime_Exc(self): > > self.assertRaises(ValueError,self.cwp.getSurplusLabourTime(self.cwp.ww,self.cwp.uvc)) > > > [This last line should indented, but it refuses to do so!] What is “it” which refuses to inden

Re: [Tutor] unittest for: Raises an exception

2015-02-18 Thread Raúl Cumplido
Hi, When using self.assertRaises like this you should pass a callable (the function you are going to call), but not call the function on the test. The problem is when the function takes arguments. At this point you need to create a callable with the two arguments. That can be done with functools b