Skip to content

Commit 0b8943b

Browse files
committed
Move tests that use dataframe preprocessor
1 parent 9d637a8 commit 0b8943b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+220
-379
lines changed

src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/implode.kt

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/test/kotlin/org/jetbrains/kotlinx/dataframe/testSets/person/BaseTest.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package org.jetbrains.kotlinx.dataframe.testSets.person
22

3+
import org.jetbrains.kotlinx.dataframe.ColumnsContainer
4+
import org.jetbrains.kotlinx.dataframe.DataColumn
35
import org.jetbrains.kotlinx.dataframe.DataFrame
6+
import org.jetbrains.kotlinx.dataframe.DataRow
47
import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
58
import org.jetbrains.kotlinx.dataframe.api.cast
69
import org.jetbrains.kotlinx.dataframe.api.column
@@ -15,6 +18,15 @@ interface Person {
1518
val weight: Int?
1619
}
1720

21+
val DataRow<Person>.name: String get() = this["name"] as String
22+
val DataRow<Person>.age: Int get() = this["age"] as Int
23+
val DataRow<Person>.city: String? get() = this["city"] as String?
24+
val DataRow<Person>.weight: Int? get() = this["weight"] as Int?
25+
val ColumnsContainer<Person>.name: DataColumn<String> get() = this["name"] as DataColumn<String>
26+
val ColumnsContainer<Person>.age: DataColumn<Int> get() = this["age"] as DataColumn<Int>
27+
val ColumnsContainer<Person>.city: DataColumn<String?> get() = this["city"] as DataColumn<String?>
28+
val ColumnsContainer<Person>.weight: DataColumn<Int?> get() = this["weight"] as DataColumn<Int?>
29+
1830
open class BaseTest {
1931

2032
// Data set

src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/add.kt renamed to tests/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/add.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.jetbrains.kotlinx.dataframe.api
22

33
import io.kotest.matchers.shouldBe
4-
import org.jetbrains.kotlinx.dataframe.prev
54
import org.junit.Test
65

76
class AddTests {
@@ -10,7 +9,7 @@ class AddTests {
109
fun `add with new`() {
1110
val x by columnOf(7, 2, 0, 3, 4, 2, 5, 0, 3, 4)
1211
val df = dataFrameOf(x)
13-
val added = df.add("Y") { if (x() == 0) 0 else (prev?.new() ?: 0) + 1 }
12+
val added = df.add("Y") { if (x() == 0) 0 else (prev()?.new() ?: 0) + 1 }
1413
val expected = listOf(1, 2, 0, 1, 2, 3, 4, 0, 1, 2)
1514
added["Y"].values() shouldBe expected
1615
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.jetbrains.kotlinx.dataframe.api
22

33
import io.kotest.matchers.shouldBe
4-
import org.jetbrains.kotlinx.dataframe.nrow
54
import org.jetbrains.kotlinx.dataframe.size
65
import org.junit.Test
76

@@ -12,7 +11,7 @@ class ChunkedTests {
1211
val a by columnOf(listOf(1, 2, 3).toColumn("b"), listOf(4, 5, 6).toColumn("c"))
1312
val chunked = a.asColumnGroup().chunked(2)
1413
chunked.size shouldBe 2
15-
chunked.name shouldBe "a"
16-
chunked[1].nrow shouldBe 1
14+
chunked.name() shouldBe "a"
15+
chunked[1].rowsCount() shouldBe 1
1716
}
1817
}

src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/corr.kt renamed to tests/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/corr.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package org.jetbrains.kotlinx.dataframe.api
33
import io.kotest.matchers.doubles.ToleranceMatcher
44
import io.kotest.matchers.should
55
import io.kotest.matchers.shouldBe
6-
import org.jetbrains.kotlinx.dataframe.ncol
7-
import org.jetbrains.kotlinx.dataframe.nrow
86
import org.junit.Test
97

108
class CorrTests {
@@ -17,8 +15,8 @@ class CorrTests {
1715
@Test
1816
fun `corr with boolean`() {
1917
val corr = df.corr("a", "b").with("c")
20-
corr.nrow shouldBe 2
21-
corr.ncol shouldBe 2
18+
corr.rowsCount() shouldBe 2
19+
corr.columnsCount() shouldBe 2
2220
corr.getColumn(0) shouldBe (columnOf("a", "b") named "column")
2321
corr.getColumn(1).name() shouldBe "c"
2422
corr["c"][0] as Double should ToleranceMatcher(1.0, 0.01)

0 commit comments

Comments
 (0)