@@ -2,6 +2,7 @@ package org.jetbrains.kotlinx.dataframe.api
2
2
3
3
import io.kotest.matchers.should
4
4
import io.kotest.matchers.shouldBe
5
+ import io.kotest.matchers.shouldNotBe
5
6
import kotlinx.datetime.DateTimeUnit
6
7
import kotlinx.datetime.Instant
7
8
import kotlinx.datetime.LocalDate
@@ -28,6 +29,8 @@ import kotlin.time.Duration.Companion.milliseconds
28
29
import kotlin.time.Duration.Companion.minutes
29
30
import kotlin.time.Duration.Companion.nanoseconds
30
31
import kotlin.time.Duration.Companion.seconds
32
+ import kotlin.uuid.ExperimentalUuidApi
33
+ import kotlin.uuid.Uuid
31
34
import java.time.Duration as JavaDuration
32
35
import java.time.Instant as JavaInstant
33
36
@@ -481,6 +484,28 @@ class ParseTests {
481
484
df.parse()
482
485
}
483
486
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
+
484
509
/* *
485
510
* Asserts that all elements of the iterable are equal to each other
486
511
*/
0 commit comments