From 4b1ea7068747ebb7623e980ed6dede3e908b1aa7 Mon Sep 17 00:00:00 2001 From: Sergio Durigan Junior Date: Tue, 23 Jan 2024 10:14:41 -0500 Subject: [PATCH] Replace deprecated assertDictContainsSubset The method was deprecated in Python 3.2. Replace it with assertLessEqual, which uses set logic to perform the same operation. Signed-off-by: Sergio Durigan Junior --- packages/mbed-ls/test/mbedls_toolsbase.py | 6 +++--- test/detect/mbedls_toolsbase.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/mbed-ls/test/mbedls_toolsbase.py b/packages/mbed-ls/test/mbedls_toolsbase.py index 0a90017831..518d45b3b2 100644 --- a/packages/mbed-ls/test/mbedls_toolsbase.py +++ b/packages/mbed-ls/test/mbedls_toolsbase.py @@ -418,7 +418,7 @@ def test_fs_after(self): self.assertIsNotNone(ret_with_details[0]) self.assertEqual(ret[0]['target_id'], new_device_id) self.assertEqual(ret_with_details[0]['daplink_automation_allowed'], '0') - self.assertDictContainsSubset(ret[0], ret_with_details[0]) + self.assertLessEqual(ret[0].items(), ret_with_details[0].items()) _read_htm.assert_called_with(device['mount_point']) _up_details.assert_called_with(device['mount_point']) @@ -494,7 +494,7 @@ def test_fs_before(self): self.assertIsNotNone(ret_with_details[0]) self.assertEqual(ret[0]['target_id'], new_device_id) self.assertEqual(ret_with_details[0]['daplink_automation_allowed'], '0') - self.assertDictContainsSubset(ret[0], ret_with_details[0]) + self.assertLessEqual(ret[0].items(), ret_with_details[0].items()) _read_htm.assert_called_with(device['mount_point']) _up_details.assert_called_with(device['mount_point']) @@ -516,7 +516,7 @@ def test_fs_before(self): self.assertIsNotNone(ret_with_details[0]) self.assertEqual(ret[0]['target_id'], new_device_id) self.assertEqual(ret_with_details[0]['daplink_automation_allowed'], '0') - self.assertDictContainsSubset(ret[0], ret_with_details[0]) + self.assertLessEqual(ret[0].items(), ret_with_details[0].items()) _read_htm.assert_called_with(device['mount_point']) _up_details.assert_called_with(device['mount_point']) diff --git a/test/detect/mbedls_toolsbase.py b/test/detect/mbedls_toolsbase.py index a4221c2fd6..9067590c33 100644 --- a/test/detect/mbedls_toolsbase.py +++ b/test/detect/mbedls_toolsbase.py @@ -413,7 +413,7 @@ def test_fs_after(self): self.assertIsNotNone(ret_with_details[0]) self.assertEqual(ret[0]['target_id'], new_device_id) self.assertEqual(ret_with_details[0]['daplink_automation_allowed'], '0') - self.assertDictContainsSubset(ret[0], ret_with_details[0]) + self.assertLessEqual(ret[0].items(), ret_with_details[0].items()) _read_htm.assert_called_with(device['mount_point']) _up_details.assert_called_with(device['mount_point']) @@ -489,7 +489,7 @@ def test_fs_before(self): self.assertIsNotNone(ret_with_details[0]) self.assertEqual(ret[0]['target_id'], new_device_id) self.assertEqual(ret_with_details[0]['daplink_automation_allowed'], '0') - self.assertDictContainsSubset(ret[0], ret_with_details[0]) + self.assertLessEqual(ret[0].items(), ret_with_details[0].items()) _read_htm.assert_called_with(device['mount_point']) _up_details.assert_called_with(device['mount_point']) @@ -511,7 +511,7 @@ def test_fs_before(self): self.assertIsNotNone(ret_with_details[0]) self.assertEqual(ret[0]['target_id'], new_device_id) self.assertEqual(ret_with_details[0]['daplink_automation_allowed'], '0') - self.assertDictContainsSubset(ret[0], ret_with_details[0]) + self.assertLessEqual(ret[0].items(), ret_with_details[0].items()) _read_htm.assert_called_with(device['mount_point']) _up_details.assert_called_with(device['mount_point'])