Replace deprecated assertDictContainsSubset

The method is deprecated since Python 3.2[1] and shows the following
DeprecationWarning.

/usr/lib/python3.9/unittest/case.py:1134: DeprecationWarning:
assertDictContainsSubset is deprecated
  warnings.warn('assertDictContainsSubset is deprecated',

[1] https://docs.python.org/3/whatsnew/3.2.html#unittest

Closes-Bug: #1938103
Change-Id: Iab60f52ffbfb3668e9509ce86e105917c616b8a9
This commit is contained in:
Takashi Kajinami 2021-09-05 01:00:29 +09:00
parent 701214481f
commit 34acbd6ff8
1 changed files with 4 additions and 4 deletions

View File

@ -1495,14 +1495,14 @@ class TestMl2PortsV2(test_plugin.TestPortsV2, Ml2PluginV2TestCase):
self.assertEqual(expected_dict, actual_dict)
self.assertIn('orig_binding', b_update_events[1].metadata)
self.assertIn('new_binding', b_update_events[1].metadata)
self.assertDictContainsSubset({'context': ctx}, actual_dict)
self.assertDictContainsSubset({
self.assertLessEqual({'context': ctx}.items(), actual_dict.items())
self.assertLessEqual({
'admin_state_up': True,
'binding:host_id': 'newhost',
'binding:vif_type': 'unbound',
'binding:vnic_type': u'normal',
'status': 'DOWN'},
b_update_events[1].latest_state)
'status': 'DOWN'}.items(),
b_update_events[1].latest_state.items())
self.assertEqual('newhost', a_update_events[0]['binding:host_id'])
self.assertEqual('unbound', a_update_events[0]['binding:vif_type'])
self.assertEqual('newhost', a_update_events[1]['binding:host_id'])