Commit e9724398

Stainless Bot <107565488+stainless-bot@users.noreply.github.com>
2024-04-25 12:19:39
release: 1.23.6 (#1372) tag: v1.23.6
* chore(internal): update test helper function (#1371) * release: 1.23.6
1 parent 290e7ad
src/openai/_version.py
@@ -1,4 +1,4 @@
 # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
 
 __title__ = "openai"
-__version__ = "1.23.5"  # x-release-please-version
+__version__ = "1.23.6"  # x-release-please-version
tests/utils.py
@@ -97,7 +97,22 @@ def assert_matches_type(
             assert_matches_type(key_type, key, path=[*path, "<dict key>"])
             assert_matches_type(items_type, item, path=[*path, "<dict item>"])
     elif is_union_type(type_):
-        for i, variant in enumerate(get_args(type_)):
+        variants = get_args(type_)
+
+        try:
+            none_index = variants.index(type(None))
+        except ValueError:
+            pass
+        else:
+            # special case Optional[T] for better error messages
+            if len(variants) == 2:
+                if value is None:
+                    # valid
+                    return
+
+                return assert_matches_type(type_=variants[not none_index], value=value, path=path)
+
+        for i, variant in enumerate(variants):
             try:
                 assert_matches_type(variant, value, path=[*path, f"variant {i}"])
                 return
.release-please-manifest.json
@@ -1,3 +1,3 @@
 {
-  ".": "1.23.5"
+  ".": "1.23.6"
 }
\ No newline at end of file
CHANGELOG.md
@@ -1,5 +1,13 @@
 # Changelog
 
+## 1.23.6 (2024-04-25)
+
+Full Changelog: [v1.23.5...v1.23.6](https://github.com/openai/openai-python/compare/v1.23.5...v1.23.6)
+
+### Chores
+
+* **internal:** update test helper function ([#1371](https://github.com/openai/openai-python/issues/1371)) ([6607c4a](https://github.com/openai/openai-python/commit/6607c4a491fd1912f9222d6fe464ccef6e865eac))
+
 ## 1.23.5 (2024-04-24)
 
 Full Changelog: [v1.23.4...v1.23.5](https://github.com/openai/openai-python/compare/v1.23.4...v1.23.5)
pyproject.toml
@@ -1,6 +1,6 @@
 [project]
 name = "openai"
-version = "1.23.5"
+version = "1.23.6"
 description = "The official Python library for the openai API"
 dynamic = ["readme"]
 license = "Apache-2.0"