From 58e1556eb0324eb26f8e99c5511fa8ab2dfb34b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 17 Jan 2023 16:12:20 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Add=20test=20for=20octoprint.settin?= =?UTF-8?q?gs.=5Fpaths?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/settings/test_settings.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/settings/test_settings.py b/tests/settings/test_settings.py index 4192ec1fc..c26530e85 100644 --- a/tests/settings/test_settings.py +++ b/tests/settings/test_settings.py @@ -653,6 +653,24 @@ class HelpersTest(unittest.TestCase): def test_valid_boolean_trues(self, value, expected): self.assertEqual(expected, value in octoprint.settings.valid_boolean_trues) + @ddt.data( + ( + {"a": {"b": "c"}, "d": 1, "e": {"f": {"g": {"h": 1, "i": 1, "j": 1}}}}, + [ + ["a", "b"], + [ + "d", + ], + ["e", "f", "g", "h"], + ["e", "f", "g", "i"], + ["e", "f", "g", "j"], + ], + ), + ) + @ddt.unpack + def test_recursive_paths(self, value, expected): + self.assertEqual(expected, list(octoprint.settings._paths([], value))) + def _key(*path): return octoprint.settings._CHAINMAP_SEP.join(path)