From 57f8b571deccef4164ae8f812d085ee1f30ec910 Mon Sep 17 00:00:00 2001 From: Vitor Hideyoshi Date: Mon, 24 Nov 2025 19:38:53 -0300 Subject: [PATCH] feat: adds tests for SchemaConverter.get_cached_ref --- tests/test_schema_converter.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/test_schema_converter.py b/tests/test_schema_converter.py index 1e86f52..a5cd948 100644 --- a/tests/test_schema_converter.py +++ b/tests/test_schema_converter.py @@ -880,3 +880,23 @@ class TestSchemaConverter(TestCase): self.assertIs(converter1._ref_cache, converter2._ref_cache) self.assertIs(model1, model2) + + def test_get_type_from_cache(self): + schema = { + "title": "Person", + "type": "object", + "properties": { + "name": {"type": "string"}, + "age": {"type": "integer"}, + "emergency_contact": { + "$ref": "#", + }, + }, + "required": ["name", "age"], + } + + model = self.converter.build_with_instance(schema) + + cached_model = self.converter.get_cached_ref("Person") + + self.assertIs(model, cached_model)