Skip to content

Commit 66b92b5

Browse files
committed
Add test cases for union type
1 parent f748cda commit 66b92b5

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

python/cocoindex/tests/test_convert.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,30 @@ def test_roundtrip_union_with_inactive_uuid() -> None:
495495
validate_full_roundtrip(value, t)
496496

497497

498+
#def test_roundtrip_union_datetime() -> None:
499+
# t = str | uuid.UUID | float | int | datetime.datetime
500+
# value = datetime.datetime.now()
501+
# validate_full_roundtrip(value, t)
502+
503+
504+
def test_roundtrip_union_date() -> None:
505+
t = str | uuid.UUID | float | int | datetime.date
506+
value = datetime.date.today()
507+
validate_full_roundtrip(value, t)
508+
509+
510+
def test_roundtrip_union_time() -> None:
511+
t = str | uuid.UUID | float | int | datetime.time
512+
value = datetime.time()
513+
validate_full_roundtrip(value, t)
514+
515+
516+
def test_roundtrip_union_timedelta() -> None:
517+
t = str | uuid.UUID | float | int | datetime.timedelta
518+
value = datetime.timedelta(hours=39, minutes=10, seconds=1)
519+
validate_full_roundtrip(value, t)
520+
521+
498522
def test_roundtrip_ltable() -> None:
499523
t = list[Order]
500524
value = [Order("O1", "item1", 10.0), Order("O2", "item2", 20.0)]

0 commit comments

Comments
 (0)