Switch from unittest2 compat methods to Python 3.x methods
With the removal of Python 2.x we can remove the unittest2 compat wrappers and switch to assertCountEqual instead of assertItemsEqual We have been able to use them since then, because testtools required unittest2, which still included it. With testtools removing Python 2.7 support [3][4], we will lose support for assertItemsEqual, so we should switch to use assertCountEqual. [1] - https://bugs.python.org/issue17866 [2] - https://hg.python.org/cpython/rev/d9921cb6e3cd [3] - testing-cabal/testtools#286 [4] - testing-cabal/testtools#277 Change-Id: I3e8725eb77ea947e71d85ea406a60ed94c7bf971changes/38/739638/1
parent
f68e3aba49
commit
103653503c
|
@ -396,7 +396,7 @@ class TestAmphora(base.BaseAPITest):
|
|||
links = middle[self.root_tag_links]
|
||||
self.assertEqual(1, len(objs))
|
||||
self.assertEqual(2, len(links))
|
||||
self.assertItemsEqual(['previous', 'next'],
|
||||
self.assertCountEqual(['previous', 'next'],
|
||||
[link['rel'] for link in links])
|
||||
|
||||
def test_get_all_fields_filter(self):
|
||||
|
|
|
@ -513,7 +513,7 @@ class TestHealthMonitor(base.BaseAPITest):
|
|||
links = middle[self.root_tag_links]
|
||||
self.assertEqual(1, len(objs))
|
||||
self.assertEqual(2, len(links))
|
||||
self.assertItemsEqual(['previous', 'next'],
|
||||
self.assertCountEqual(['previous', 'next'],
|
||||
[link['rel'] for link in links])
|
||||
|
||||
def test_get_all_fields_filter(self):
|
||||
|
|
|
@ -442,7 +442,7 @@ class TestL7Policy(base.BaseAPITest):
|
|||
links = middle[self.root_tag_links]
|
||||
self.assertEqual(1, len(objs))
|
||||
self.assertEqual(2, len(links))
|
||||
self.assertItemsEqual(['previous', 'next'],
|
||||
self.assertCountEqual(['previous', 'next'],
|
||||
[link['rel'] for link in links])
|
||||
|
||||
def test_get_all_fields_filter(self):
|
||||
|
|
|
@ -291,7 +291,7 @@ class TestL7Rule(base.BaseAPITest):
|
|||
links = middle[self.root_tag_links]
|
||||
self.assertEqual(1, len(objs))
|
||||
self.assertEqual(2, len(links))
|
||||
self.assertItemsEqual(['previous', 'next'],
|
||||
self.assertCountEqual(['previous', 'next'],
|
||||
[link['rel'] for link in links])
|
||||
|
||||
def test_get_all_fields_filter(self):
|
||||
|
|
|
@ -317,7 +317,7 @@ class TestListener(base.BaseAPITest):
|
|||
links = middle[self.root_tag_links]
|
||||
self.assertEqual(1, len(objs))
|
||||
self.assertEqual(2, len(links))
|
||||
self.assertItemsEqual(['previous', 'next'],
|
||||
self.assertCountEqual(['previous', 'next'],
|
||||
[link['rel'] for link in links])
|
||||
|
||||
def test_get_all_fields_filter(self):
|
||||
|
@ -2244,7 +2244,7 @@ class TestListener(base.BaseAPITest):
|
|||
listener_path = self.LISTENER_PATH.format(
|
||||
listener_id=listener['listener']['id'])
|
||||
get_listener = self.get(listener_path).json['listener']
|
||||
self.assertItemsEqual([sni_id1, sni_id2],
|
||||
self.assertCountEqual([sni_id1, sni_id2],
|
||||
get_listener['sni_container_refs'])
|
||||
|
||||
# TODO(johnsom) Fix this when there is a noop certificate manager
|
||||
|
|
|
@ -1347,7 +1347,7 @@ class TestLoadBalancer(base.BaseAPITest):
|
|||
links = middle[self.root_tag_links]
|
||||
self.assertEqual(1, len(objs))
|
||||
self.assertEqual(2, len(links))
|
||||
self.assertItemsEqual(['previous', 'next'],
|
||||
self.assertCountEqual(['previous', 'next'],
|
||||
[link['rel'] for link in links])
|
||||
|
||||
def test_get_all_fields_filter(self):
|
||||
|
|
|
@ -294,7 +294,7 @@ class TestMember(base.BaseAPITest):
|
|||
links = middle[self.root_tag_links]
|
||||
self.assertEqual(1, len(objs))
|
||||
self.assertEqual(2, len(links))
|
||||
self.assertItemsEqual(['previous', 'next'],
|
||||
self.assertCountEqual(['previous', 'next'],
|
||||
[link['rel'] for link in links])
|
||||
|
||||
def test_get_all_fields_filter(self):
|
||||
|
|
|
@ -476,7 +476,7 @@ class TestPool(base.BaseAPITest):
|
|||
links = middle[self.root_tag_links]
|
||||
self.assertEqual(1, len(objs))
|
||||
self.assertEqual(2, len(links))
|
||||
self.assertItemsEqual(['previous', 'next'],
|
||||
self.assertCountEqual(['previous', 'next'],
|
||||
[link['rel'] for link in links])
|
||||
|
||||
def test_get_all_fields_filter(self):
|
||||
|
|
|
@ -650,7 +650,7 @@ class TestQuotas(base.BaseAPITest):
|
|||
links = middle[self.root_tag_links]
|
||||
self.assertEqual(1, len(objs))
|
||||
self.assertEqual(2, len(links))
|
||||
self.assertItemsEqual(['previous', 'next'],
|
||||
self.assertCountEqual(['previous', 'next'],
|
||||
[link['rel'] for link in links])
|
||||
|
||||
def test_get_default_quotas(self):
|
||||
|
|
Loading…
Reference in New Issue