Skip to content

Commit e516fe2

Browse files
authored
Add test to check csv creation whithout header
1 parent c648b5d commit e516fe2

File tree

1 file changed

+16
-0
lines changed
  • core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/io

1 file changed

+16
-0
lines changed

core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/io/CsvTests.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,22 @@ class CsvTests {
214214
df.columnsCount() shouldBe 3
215215
df.rowsCount() shouldBe 2
216216
}
217+
218+
@Test
219+
fun `write csv whitout header produce correct file`() {
220+
val df = dataFrameOf("a", "b", "c")(
221+
1, 2, 3,
222+
1, 3, 2
223+
)
224+
df.writeCSV(
225+
"src/test/resources/without_header.csv",
226+
CSVFormat.DEFAULT.withSkipHeaderRecord()
227+
)
228+
val producedFile = File("src/test/resources/without_header.csv")
229+
producedFile.exists() shouldBe true
230+
producedFile.readText() shouldBe "a,b,c\r\n1,2,3\r\n1,3,2\r\n"
231+
producedFile.delete()
232+
}
217233

218234
companion object {
219235
private val simpleCsv = testCsv("testCSV")

0 commit comments

Comments
 (0)