diff options
| author | Tang Chen <chen.tang@easystack.cn> | 2016-03-14 16:22:24 +0800 |
|---|---|---|
| committer | Tang Chen <chen.tang@easystack.cn> | 2016-03-14 16:22:24 +0800 |
| commit | 7b2e3c7d1cbe6e55de4bf1d51cb4cc0862c60d44 (patch) | |
| tree | 39e34616f966529ca8649c573da1e053436c5ab7 /openstackclient | |
| parent | 76081239d2f99acb36bdddddf5339e5d3cc8ae4a (diff) | |
| download | python-openstackclient-7b2e3c7d1cbe6e55de4bf1d51cb4cc0862c60d44.tar.gz | |
Use assertItemsEqual() instead of assertListEqual()
assertListEqual() is order sensitive. So we need to sort
the lists before we compare them. Use assertItemsEqual()
instead is better.
Change-Id: I9eaa98716c7401f5b099b007438acc916dae619b
Diffstat (limited to 'openstackclient')
| -rw-r--r-- | openstackclient/tests/common/test_parseractions.py | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/openstackclient/tests/common/test_parseractions.py b/openstackclient/tests/common/test_parseractions.py index a4ee07bf..5c5ca3d3 100644 --- a/openstackclient/tests/common/test_parseractions.py +++ b/openstackclient/tests/common/test_parseractions.py @@ -91,11 +91,7 @@ class TestMultiKeyValueAction(utils.TestCase): {'req1': 'aaa', 'req2': 'bbb'}, {'req1': '', 'req2': ''}, ] - # Need to sort the lists before comparing them - key = lambda x: x['req1'] - expect.sort(key=key) - actual.sort(key=key) - self.assertListEqual(expect, actual) + self.assertItemsEqual(expect, actual) def test_empty_required_optional(self): self.parser.add_argument( @@ -119,11 +115,7 @@ class TestMultiKeyValueAction(utils.TestCase): {'req1': 'aaa', 'req2': 'bbb'}, {'req1': '', 'req2': ''}, ] - # Need to sort the lists before comparing them - key = lambda x: x['req1'] - expect.sort(key=key) - actual.sort(key=key) - self.assertListEqual(expect, actual) + self.assertItemsEqual(expect, actual) def test_error_values_with_comma(self): self.assertRaises( |
