참고소스 수정본

This commit is contained in:
LASTA_DEV01\lasta
2026-05-12 19:40:31 +09:00
parent 0f34a451fc
commit 2e9204243d
8708 changed files with 3259488 additions and 869 deletions

View File

@@ -0,0 +1,26 @@
import unittest
import sys
from instructor.dsl.simple_type import is_simple_type
from instructor.utils.core import prepare_response_model
class TestFizzbuzzFix(unittest.TestCase):
def test_fizzbuzz_response_model(self):
if sys.version_info < (3, 10):
self.skipTest("Union pipe syntax is only available in Python 3.10+")
"""Test that list[int | str] works correctly as a response model."""
# This is the type used in the fizzbuzz example
response_model = list[int | str]
# First check that it's correctly identified as a simple type
self.assertTrue(
is_simple_type(response_model),
f"list[int | str] should be a simple type in Python {sys.version_info.major}.{sys.version_info.minor}",
)
# Then check that prepare_response_model handles it correctly
prepared_model = prepare_response_model(response_model)
self.assertIsNotNone(
prepared_model,
"prepare_response_model should not return None for list[int | str]",
)