1
0
mirror of https://github.com/l1ving/youtube-dl synced 2024-11-20 19:02:56 +08:00

[test] use descriptive variable name

This commit is contained in:
Qijiang Fan 2015-09-30 10:30:04 +02:00 committed by Sergey M․
parent 40c931de4b
commit 687c04cbb8

View File

@ -128,15 +128,13 @@ def expect_value(self, got, expected, field):
self.assertEqual(len(expected), len(got), self.assertEqual(len(expected), len(got),
'Expect a list of length %d, but got a list of length %d' % ( 'Expect a list of length %d, but got a list of length %d' % (
len(expected), len(got))) len(expected), len(got)))
_id = 0 for index, (item_got, item_expected) in enumerate(zip(got, expected)):
for i, j in zip(got, expected): type_got = type(item_got)
_type_i = type(i) type_expected = type(item_expected)
_type_j = type(j) self.assertEqual(type_expected, type_got,
self.assertEqual(_type_j, _type_i,
'Type doesn\'t match at element %d of the list in field %s, expect %s, got %s' % ( 'Type doesn\'t match at element %d of the list in field %s, expect %s, got %s' % (
_id, field, _type_j, _type_i)) index, field, type_expected, type_got))
expect_value(self, i, j, field) expect_value(self, item_got, item_expected, field)
_id += 1
else: else:
if isinstance(expected, compat_str) and expected.startswith('md5:'): if isinstance(expected, compat_str) and expected.startswith('md5:'):
got = 'md5:' + md5(got) got = 'md5:' + md5(got)