File tree Expand file tree Collapse file tree 3 files changed +654
-282
lines changed
dataframe-jdbc/src/test/kotlin/org/jetbrains/kotlinx/dataframe/io Expand file tree Collapse file tree 3 files changed +654
-282
lines changed Original file line number Diff line number Diff line change 1
1
package org.jetbrains.kotlinx.dataframe.io
2
2
3
+ import io.kotest.assertions.withClue
3
4
import io.kotest.matchers.shouldBe
4
5
import org.intellij.lang.annotations.Language
6
+ import org.jetbrains.kotlinx.dataframe.AnyFrame
5
7
import org.jetbrains.kotlinx.dataframe.DataFrame
8
+ import org.jetbrains.kotlinx.dataframe.api.inferType
6
9
import org.jetbrains.kotlinx.dataframe.api.schema
7
10
import org.jetbrains.kotlinx.dataframe.io.db.MsSql
8
11
import java.sql.Connection
@@ -128,3 +131,26 @@ internal fun inferNullability(connection: Connection) {
128
131
129
132
connection.createStatement().execute(" DROP TABLE TestTable1" )
130
133
}
134
+
135
+ /* *
136
+ * Helper to check whether the provided schema matches the inferred schema.
137
+ *
138
+ * It must hold that all types in the provided schema are equal or super to
139
+ * the corresponding types in the inferred schema.
140
+ */
141
+ @Suppress(" INVISIBLE_REFERENCE" )
142
+ fun AnyFrame.assertInferredTypesMatchSchema () {
143
+ withClue({
144
+ """
145
+ |Inferred schema must be <: Provided schema
146
+ |
147
+ |Inferred Schema:
148
+ |${inferType().schema().toString().lines().joinToString(" \n |" )}
149
+ |
150
+ |Provided Schema:
151
+ |${schema().toString().lines().joinToString(" \n |" )}
152
+ """ .trimMargin()
153
+ }) {
154
+ schema().compare(inferType().schema()).isSuperOrEqual() shouldBe true
155
+ }
156
+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments