File do-not-use-assertdictcontainssubset-in-tests.patch of Package salt
From 13fc8c64bbfc6831a6ba650fd88510b8ca62e51f Mon Sep 17 00:00:00 2001
From: Alexander Graul <agraul@suse.com>
Date: Tue, 10 Jun 2025 14:29:14 +0200
Subject: [PATCH] Do not use assertDictContainsSubset in tests
---
tests/unit/utils/test_color.py | 2 +-
tests/unit/utils/test_schema.py | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/tests/unit/utils/test_color.py b/tests/unit/utils/test_color.py
index b80b2e4eaf1..5c099bc9b97 100644
--- a/tests/unit/utils/test_color.py
+++ b/tests/unit/utils/test_color.py
@@ -13,7 +13,7 @@ class ColorUtilsTestCase(TestCase):
self.assertEqual("\x1b[0;37m", str(ret["LIGHT_GRAY"]))
ret = salt.utils.color.get_colors(use=False)
- self.assertDictContainsSubset({"LIGHT_GRAY": ""}, ret)
+ self.assertEqual("", ret["LIGHT_GRAY"])
ret = salt.utils.color.get_colors(use="LIGHT_GRAY")
# LIGHT_YELLOW now == LIGHT_GRAY
diff --git a/tests/unit/utils/test_schema.py b/tests/unit/utils/test_schema.py
index a531dd93111..24c24b2405f 100644
--- a/tests/unit/utils/test_schema.py
+++ b/tests/unit/utils/test_schema.py
@@ -96,10 +96,10 @@ class ConfigTestCase(TestCase):
"x-ordering": ["thirsty", "base", "hungry"],
"additionalProperties": False,
}
- self.assertDictContainsSubset(
+ self.assertDictEqual(
MergedConfigClass.serialize()["properties"], expected["properties"]
)
- self.assertDictContainsSubset(expected, MergedConfigClass.serialize())
+ self.assertDictEqual(expected, MergedConfigClass.serialize())
def test_configuration_items_order(self):
class One(schema.Schema):
@@ -292,7 +292,7 @@ class ConfigTestCase(TestCase):
],
"additionalProperties": False,
}
- self.assertDictContainsSubset(expected, Requirements2.serialize())
+ self.assertDictEqual(expected, Requirements2.serialize())
class Requirements3(schema.Schema):
title = "DigitalOcean"
@@ -347,7 +347,7 @@ class ConfigTestCase(TestCase):
],
"additionalProperties": False,
}
- self.assertDictContainsSubset(expected, Requirements3.serialize())
+ self.assertDictEqual(expected, Requirements3.serialize())
class Requirements4(schema.Schema):
title = "DigitalOcean"
@@ -449,7 +449,7 @@ class ConfigTestCase(TestCase):
],
"additionalProperties": False,
}
- self.assertDictContainsSubset(expected, Requirements4.serialize())
+ self.assertDictEqual(expected, Requirements4.serialize())
@pytest.mark.skipif(
HAS_JSONSCHEMA is False, reason="The 'jsonschema' library is missing"
@@ -1770,7 +1770,7 @@ class ConfigTestCase(TestCase):
),
)
- self.assertDictContainsSubset(
+ self.assertDictEqual(
TestConf.serialize(),
{
"$schema": "http://json-schema.org/draft-04/schema#",
--
2.49.0