File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
main/kotlin/org/jetbrains/kotlinx/dataframe/api
test/kotlin/org/jetbrains/kotlinx/dataframe/api Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -164,11 +164,11 @@ public fun DataColumn<String?>.convertToDouble(locale: Locale? = null): DataColu
164
164
}
165
165
}
166
166
167
- if (locale != null ) {
167
+ return if (locale != null ) {
168
168
val explicitParser = Parsers .getDoubleParser(locale)
169
- return applyParser(explicitParser)
169
+ applyParser(explicitParser)
170
170
} else {
171
- return try {
171
+ try {
172
172
val defaultParser = Parsers .getDoubleParser()
173
173
applyParser(defaultParser)
174
174
} catch (e: TypeConversionException ) {
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import org.jetbrains.kotlinx.dataframe.exceptions.TypeConverterNotFoundException
14
14
import org.jetbrains.kotlinx.dataframe.hasNulls
15
15
import org.junit.Test
16
16
import java.time.LocalTime
17
+ import java.util.*
17
18
import kotlin.reflect.*
18
19
import kotlin.time.Duration.Companion.hours
19
20
@@ -85,6 +86,10 @@ class ConvertTests {
85
86
columnOf(" 1" , " 10" , " a" ).convertTo<IntClass >()
86
87
}.row shouldBe 2
87
88
89
+ shouldThrow<CellConversionException > {
90
+ columnOf(" 1" , " x" , " 2.5" ).convertToDouble()
91
+ }.row shouldBe 1
92
+
88
93
shouldThrow<TypeConverterNotFoundException > {
89
94
columnOf(EnumClass .A ).convertTo<IntClass >()
90
95
}
You can’t perform that action at this time.
0 commit comments