@@ -2,6 +2,7 @@ package org.jetbrains.kotlinx.dataframe.api
22
33import io.kotest.matchers.should
44import io.kotest.matchers.shouldBe
5+ import io.kotest.matchers.shouldNotBe
56import kotlinx.datetime.DateTimeUnit
67import kotlinx.datetime.Instant
78import kotlinx.datetime.LocalDate
@@ -28,6 +29,8 @@ import kotlin.time.Duration.Companion.milliseconds
2829import kotlin.time.Duration.Companion.minutes
2930import kotlin.time.Duration.Companion.nanoseconds
3031import kotlin.time.Duration.Companion.seconds
32+ import kotlin.uuid.ExperimentalUuidApi
33+ import kotlin.uuid.Uuid
3134import java.time.Duration as JavaDuration
3235import java.time.Instant as JavaInstant
3336
@@ -481,6 +484,28 @@ class ParseTests {
481484 df.parse()
482485 }
483486
487+ @OptIn(ExperimentalUuidApi ::class )
488+ @Test
489+ fun `parse valid Uuid` () {
490+ val validUUID = " 550e8400-e29b-41d4-a716-446655440000"
491+ val column by columnOf(validUUID)
492+ val parsed = column.parse()
493+
494+ parsed.type() shouldBe typeOf<Uuid >()
495+ (parsed[0 ] as Uuid ).toString() shouldBe validUUID // Change UUID to Uuid
496+ }
497+
498+ @OptIn(ExperimentalUuidApi ::class )
499+ @Test
500+ fun `parse invalid Uuid` () {
501+ val invalidUUID = " this is not a UUID"
502+ val column = columnOf(invalidUUID)
503+ val parsed = column.tryParse() // tryParse as string is not formatted.
504+
505+ parsed.type() shouldNotBe typeOf<Uuid >()
506+ parsed.type() shouldBe typeOf<String >()
507+ }
508+
484509 /* *
485510 * Asserts that all elements of the iterable are equal to each other
486511 */
0 commit comments