From 689464c22d8e3db7c919495bfa414fcbd20f7318 Mon Sep 17 00:00:00 2001 From: Youri Westerman Date: Tue, 17 Jun 2025 15:02:52 +0200 Subject: [PATCH] Fix broken mypy checks --- .../client/petstore/python/tests/test_deserialization.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/samples/openapi3/client/petstore/python/tests/test_deserialization.py b/samples/openapi3/client/petstore/python/tests/test_deserialization.py index 8db2929be354..c8ae1a90c77d 100644 --- a/samples/openapi3/client/petstore/python/tests/test_deserialization.py +++ b/samples/openapi3/client/petstore/python/tests/test_deserialization.py @@ -297,7 +297,12 @@ def test_deserialize_animal(self): json_str = '{"className": "Cat", "color": "red", "declawed": true}' deserialized = petstore_api.Animal.from_json(json_str) - self.assertTrue(isinstance(deserialized, petstore_api.Cat)) + + # the following is necessary for mypy as it does not handle isinstance() within self.assertTrue() well + if not isinstance(deserialized, petstore_api.Cat): + self.assertTrue(False) + return + self.assertEqual(deserialized.class_name, "Cat") self.assertEqual(deserialized.declawed, True) self.assertEqual(deserialized.to_json(), '{"className": "Cat", "color": "red", "declawed": true}')