Re: [Tutor] Need help with two similar test cases that I have written. One works and the other fails

2016-02-07 Thread Anubhav Yadav
> > Be careful. Now you have a test that always succeeds. > > No, I'm wrong. Sorry about that: I misread the numerical range. > This is the first time I am ever writing unit tests, and I am glad I am doing it. Thanks a lot for all your help!. ___ Tuto

Re: [Tutor] Need help with two similar test cases that I have written. One works and the other fails

2016-02-07 Thread Danny Yoo
On Feb 7, 2016 8:38 AM, "Danny Yoo" wrote: > > : > > > > def test_red_temperature_simulation(self): > > """ > > Method to test the red_temperature_simulation method > > """ > > for i in range(100): > > test_value = red_temperature_simulation() >

Re: [Tutor] Need help with two similar test cases that I have written. One works and the other fails

2016-02-07 Thread Danny Yoo
: > > def test_red_temperature_simulation(self): > """ > Method to test the red_temperature_simulation method > """ > for i in range(100): > test_value = red_temperature_simulation() > self.assertTrue((test_value < 100.0) or (test_valu

Re: [Tutor] Need help with two similar test cases that I have written. One works and the other fails

2016-02-07 Thread Anubhav Yadav
> > when my program is in the yellow state, it should generate the numbers > > from 100.0-100.5 > > and 102.5-103.0 > > The "and" is a bit misleading as you want to allow values that are in the > first *or* the second intrval. When you spell that in Python it becomes > > temperature = yellow_temper

Re: [Tutor] Need help with two similar test cases that I have written. One works and the other fails

2016-02-07 Thread Peter Otten
Anubhav Yadav wrote: >> Hi Anubhav, >> >> Ah! The assert functions are meant to be used as statements, not as >> composable expressions. If you're familiar with the idea of side >> effects, then you need to understand that you should be calling the >> assert functions just for their side effects

Re: [Tutor] Need help with two similar test cases that I have written. One works and the other fails

2016-02-07 Thread Anubhav Yadav
> Hi Anubhav, > > Ah! The assert functions are meant to be used as statements, not as > composable expressions. If you're familiar with the idea of side effects, > then you need to understand that you should be calling the assert functions > just for their side effects, not for their return value