I am doing some unit testing in general in python. I get below mention AssertionError. I want to check the temperature range that if it is less than 30 and greater than 25 , then code should pass, but it gives me error. I can't figure out where I am making mistake.
test_csv_read_data_headers (__main__.ParseCSVTest) ... ok
test_data_fuelConsumption (__main__.ParseCSVTest) ... ok
test_data_temperature (__main__.ParseCSVTest) ...FAIL
test_data_timestamp (__main__.ParseCSVTest) ... ok
======================================================================
FAIL: test_data_temp (main.ParseCSVTest)
Traceback (most recent call last):
File "try.py", line 36, in test_data_temperature
30 > ali > 25, True
AssertionError: False != True
Ran 4 tests in 0.014s
FAILED (failures=1)
the code is as follow for temperature portion where my test fails.
def test_data_temperature(self):
column = [row[0].split()[3] for row in read_data(self.data)[1:]]
ali = column[0:4]
print ali
self.assertEqual(
30 > ali > 25, True
)
I print data in ali and it is in form of a list
['25.8', '25.6', '25.8', '25.8']
I am confuse that how can I check range of this and make assertions so that it pass the test. If somebody give a tip or example. I will really grateful.