> > 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_temperature_simulation() > self.assertTrue( > (100.0 <= temperature < 100.5) > or (102.5 <= temperature < 103.0)) > > I agree, That's the mistake I made. I fixed it as follows:
def test_red_temperature_simulation(self): """ Method to test the red_temperature_simulation method """ for i in range(1000000): test_value = red_temperature_simulation() self.assertTrue((test_value < 100.0) or (test_value > 103.0), msg="Test failed for {}".format(test_value)) And now everything works the way it should. Thanks for all your help :) -- Regards, Anubhav Yadav KPIT Technologies, Pune. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor