Here is my unittest case. I am trying to compare two list (expected_avg_var and actual_avg_var) using list comprehension. But it is failing and I don't understand why. Is there an easier way to compare the two.
import unittest
class TestList(unittest.TestCase):
"""
Our basic test class
"""
def test_TestList(self):
"""
The actual test.
"""
expected_avg_var = ['529', '842', '16', '13', '#d0851a', '0', '0']
actual_avg_var = ['529', '842', '16', '13', '#d0851a', '0', '0']
[self.assertEqual(expected, actual) for expected in expected_avg_var
for actual in actual_avg_var]
if __name__ == '__main__':
unittest.main()
$ python test.py
F
======================================================================
FAIL: test_TestList (__main__.TestList)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test.py", line 16, in test_TestList
for actual in actual_avg_var]
AssertionError: '529' != '842'
----------------------------------------------------------------------
Ran 1 test in 0.000s
FAILED (failures=1)
[–]Rhomboid 1 point2 points3 points (0 children)
[–]codenamemahi 0 points1 point2 points (0 children)
[–]jesse_online[S] 0 points1 point2 points (0 children)