From 6dad6e0c68ea026f6ae31751f22ad8742215dd1d Mon Sep 17 00:00:00 2001 From: Vitor Hideyoshi Date: Tue, 19 Aug 2025 18:58:33 -0300 Subject: [PATCH] (feat): Adds Aditional Test for Non-Hashable Const Values --- tests/test_schema_converter.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/test_schema_converter.py b/tests/test_schema_converter.py index c5a7c3a..9a756c7 100644 --- a/tests/test_schema_converter.py +++ b/tests/test_schema_converter.py @@ -701,6 +701,29 @@ class TestSchemaConverter(TestCase): with self.assertRaises(ValueError): Model(name="Canada") + def test_const_type_parser_with_non_hashable_value(self): + schema = { + "title": "Country", + "type": "object", + "properties": { + "name": { + "const": ["Brazil"], + } + }, + "required": ["name"], + } + + Model = SchemaConverter.build(schema) + + obj = Model() + self.assertEqual(obj.name, ["Brazil"]) + + with self.assertRaises(ValueError): + obj.name = ["Argentina"] + + with self.assertRaises(ValueError): + Model(name=["Argentina"]) + def test_null_type_parser(self): schema = { "title": "Test",