File tree Expand file tree Collapse file tree 2 files changed +9
-16
lines changed
Expand file tree Collapse file tree 2 files changed +9
-16
lines changed Original file line number Diff line number Diff line change 1313 AnalyzedDictType ,
1414 AnalyzedListType ,
1515 AnalyzedStructType ,
16+ AnalyzedUnknownType ,
1617 AnalyzedTypeInfo ,
1718 TypeAttr ,
1819 TypeKind ,
@@ -422,15 +423,7 @@ def test_annotated_list_with_type_kind() -> None:
422423 assert result .variant .kind == "Struct"
423424
424425
425- def test_unsupported_type () -> None :
426- with pytest .raises (
427- ValueError ,
428- match = "Unsupported as a specific type annotation for CocoIndex data type.*: <class 'set'>" ,
429- ):
430- analyze_type_info (set )
431-
432- with pytest .raises (
433- ValueError ,
434- match = "Unsupported as a specific type annotation for CocoIndex data type.*: <class 'numpy.complex64'>" ,
435- ):
436- Vector [np .complex64 ]
426+ def test_unknown_type () -> None :
427+ typ = set
428+ result = analyze_type_info (typ )
429+ assert isinstance (result .variant , AnalyzedUnknownType )
Original file line number Diff line number Diff line change @@ -313,11 +313,11 @@ def analyze_type_info(t: Any) -> AnalyzedTypeInfo:
313313 kind = "OffsetDateTime"
314314 elif t is datetime .timedelta :
315315 kind = "TimeDelta"
316+
317+ if kind is None :
318+ variant = AnalyzedUnknownType ()
316319 else :
317- raise ValueError (
318- f"Unsupported as a specific type annotation for CocoIndex data type (https://cocoindex.io/docs/core/data_types): { t } "
319- )
320- variant = AnalyzedBasicType (kind = kind )
320+ variant = AnalyzedBasicType (kind = kind )
321321
322322 return AnalyzedTypeInfo (
323323 core_type = core_type ,
You can’t perform that action at this time.
0 commit comments