diff options
author | Qijiang Fan <fqj1994@gmail.com> | 2015-09-30 10:30:04 +0200 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2015-09-30 20:33:35 +0600 |
commit | 687c04cbb8d80f76b45caf9377b2d3b64462c203 (patch) | |
tree | f9d85c7c291cb07c02b1ddbe844f5263c696f4ff /test | |
parent | 40c931de4b3c06c1959362c2380f4bf243ef5702 (diff) |
[test] use descriptive variable name
Diffstat (limited to 'test')
-rw-r--r-- | test/helper.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/test/helper.py b/test/helper.py index e50d7ff28..5c44105d4 100644 --- a/test/helper.py +++ b/test/helper.py @@ -128,15 +128,13 @@ def expect_value(self, got, expected, field): self.assertEqual(len(expected), len(got), 'Expect a list of length %d, but got a list of length %d' % ( len(expected), len(got))) - _id = 0 - for i, j in zip(got, expected): - _type_i = type(i) - _type_j = type(j) - self.assertEqual(_type_j, _type_i, + for index, (item_got, item_expected) in enumerate(zip(got, expected)): + type_got = type(item_got) + type_expected = type(item_expected) + self.assertEqual(type_expected, type_got, 'Type doesn\'t match at element %d of the list in field %s, expect %s, got %s' % ( - _id, field, _type_j, _type_i)) - expect_value(self, i, j, field) - _id += 1 + index, field, type_expected, type_got)) + expect_value(self, item_got, item_expected, field) else: if isinstance(expected, compat_str) and expected.startswith('md5:'): got = 'md5:' + md5(got) |