From bf59c8327d0d2139be7f87258eba2895e37c7d34 Mon Sep 17 00:00:00 2001 From: LJ Date: Thu, 3 Jul 2025 23:47:24 -0700 Subject: [PATCH] docs(union-types): update docs for union type support --- docs/docs/core/data_types.mdx | 1 + python/cocoindex/tests/test_convert.py | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/docs/core/data_types.mdx b/docs/docs/core/data_types.mdx index a4748cc0..393fb3e8 100644 --- a/docs/docs/core/data_types.mdx +++ b/docs/docs/core/data_types.mdx @@ -38,6 +38,7 @@ This is the list of all basic types supported by CocoIndex: | TimeDelta | A duration of time | `datetime.timedelta` | `datetime.timedelta` | | Json | | `cocoindex.Json` | Any data convertible to JSON by `json` package | | Vector[*T*, *Dim*?] | *T* can be a basic type or a numeric type. *Dim* is a positive integer and optional. | `cocoindex.Vector[T]` or `cocoindex.Vector[T, Dim]` | `numpy.typing.NDArray[T]` or `list[T]` | +| Union[*T1*, *T2*, ...] | *T1*, *T2*, ... are any basic types | `T1 | T2 | ...` | `T1 | T2 | ...` | Values of all data types can be represented by values in Python's native types (as described under the Native Python Type column). However, the underlying execution engine has finer distinctions for some types, specifically: diff --git a/python/cocoindex/tests/test_convert.py b/python/cocoindex/tests/test_convert.py index ee9d200d..00850416 100644 --- a/python/cocoindex/tests/test_convert.py +++ b/python/cocoindex/tests/test_convert.py @@ -104,9 +104,7 @@ def eq(a: Any, b: Any) -> bool: ) decoder = make_engine_value_decoder([], encoded_output_type, value_type) decoded_value = decoder(value_from_engine) - assert eq(decoded_value, value), ( - f"{decoded_value} != {value}; {encoded_value}; {value_type}; {encoded_output_type}" - ) + assert eq(decoded_value, value), f"{decoded_value} != {value}" if other_decoded_values is not None: for other_value, other_type in other_decoded_values: