Skip to content

Commit c889f30

Browse files
committed
fixed tests aside from the compiler plugin
1 parent 1082586 commit c889f30

File tree

6 files changed

+124
-73
lines changed

6 files changed

+124
-73
lines changed

Diff for: core/api/core.api

+107-55
Large diffs are not rendered by default.

Diff for: core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/math/minMax.kt

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package org.jetbrains.kotlinx.dataframe.math
33
import org.jetbrains.kotlinx.dataframe.api.isNaN
44
import org.jetbrains.kotlinx.dataframe.impl.IsBetterThan
55
import org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregators.CalculateReturnType
6-
import org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregators.preserveReturnTypeNullIfEmpty
76
import org.jetbrains.kotlinx.dataframe.impl.bestByOrNull
87
import org.jetbrains.kotlinx.dataframe.impl.bestNotNaByOrNull
98
import org.jetbrains.kotlinx.dataframe.impl.canBeNaN

Diff for: core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/describe.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class DescribeTests {
6666
std.shouldBeNaN()
6767
min.isNaN shouldBe true
6868
p25 shouldBe 1.75
69-
median shouldBe 3.0
69+
median.isNaN shouldBe true
7070
p75.isNaN shouldBe true
7171
max.isNaN shouldBe true
7272
}

Diff for: core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/statistics.kt

+14-14
Original file line numberDiff line numberDiff line change
@@ -153,52 +153,52 @@ class StatisticsTests {
153153
"yearsToRetirement",
154154
)
155155

156-
val median01 = res0["age"][0] as Int
157-
median01 shouldBe 22
156+
val median01 = res0["age"][0] as Double
157+
median01 shouldBe 22.0
158158
// val median02 = res0["weight"][0] as Double
159159
// median02 shouldBe 66.0
160160

161161
// scenario #1: particular column
162162
val res1 = personsDf.groupBy("city").medianFor("age")
163163
res1.columnNames() shouldBe listOf("city", "age")
164164

165-
val median11 = res1["age"][0] as Int
166-
median11 shouldBe 22
165+
val median11 = res1["age"][0] as Double
166+
median11 shouldBe 22.0
167167

168168
// scenario #1.1: particular column via median
169169
val res11 = personsDf.groupBy("city").median("age")
170170
res11.columnNames() shouldBe listOf("city", "age")
171171

172-
val median111 = res11["age"][0] as Int
173-
median111 shouldBe 22
172+
val median111 = res11["age"][0] as Double
173+
median111 shouldBe 22.0
174174

175175
// scenario #2: particular column with new name - schema changes
176176
val res2 = personsDf.groupBy("city").median("age", name = "newAge")
177177
res2.columnNames() shouldBe listOf("city", "newAge")
178178

179-
val median21 = res2["newAge"][0] as Int
180-
median21 shouldBe 22
179+
val median21 = res2["newAge"][0] as Double
180+
median21 shouldBe 22.0
181181

182182
// scenario #2.1: particular column with new name - schema changes but via columnSelector
183183
val res21 = personsDf.groupBy("city").median(name = "newAge") { "age"<Int>() }
184184
res21.columnNames() shouldBe listOf("city", "newAge")
185185

186-
val median211 = res21["newAge"][0] as Int
187-
median211 shouldBe 22
186+
val median211 = res21["newAge"][0] as Double
187+
median211 shouldBe 22.0
188188

189189
// scenario #2.2: two columns with new name - schema changes but via columnSelector
190190
val res22 = personsDf.groupBy("city").median(name = "newAge") { "age"<Int>() and "yearsToRetirement"<Int>() }
191191
res22.columnNames() shouldBe listOf("city", "newAge")
192192

193-
val median221 = res22["newAge"][0] as Int
194-
median221 shouldBe 32
193+
val median221 = res22["newAge"][0] as Double
194+
median221 shouldBe 32.5
195195

196196
// scenario #3: create new column via expression
197197
val res3 = personsDf.groupBy("city").medianOf(name = "newAge") { "age"<Int>() * 10 }
198198
res3.columnNames() shouldBe listOf("city", "newAge")
199199

200-
val median31 = res3["newAge"][0] as Int
201-
median31 shouldBe 220
200+
val median31 = res3["newAge"][0] as Double
201+
median31 shouldBe 220.0
202202

203203
// scenario #3.1: create new column via expression with Double
204204
val res31 = personsDf.groupBy("city").medianOf(name = "newAge") { "weight"<Double>() * 10 }

Diff for: core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/testSets/person/DataFrameTests.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ class DataFrameTests : BaseTest() {
738738
this["name"].toList() shouldBe listOf("Alice", "Bob", "Charlie")
739739
this["n"].toList() shouldBe listOf(2, 2, 3)
740740
this["old count"].toList() shouldBe listOf(0, 2, 2)
741-
this["median age"].toList() shouldBe listOf(17, 37, 30)
741+
this["median age"].toList() shouldBe listOf(17.5, 37.5, 30.0)
742742
this["min age"].toList() shouldBe listOf(15, 30, 20)
743743
this["oldest origin"].toList() shouldBe listOf(null, "Dubai", "Milan")
744744
this["youngest origin"].toList() shouldBe listOf("London", "Tokyo", "Moscow")

Diff for: core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/testSets/person/DataFrameTreeTests.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ class DataFrameTreeTests : BaseTest() {
814814
.groupBy { expr { age > 30 } into "isOld" }.into(group)
815815
.aggregate {
816816
group().maxBy { rowsCount() }.weight.median() into "m"
817-
}["m"] shouldBe 61
817+
}["m"] shouldBe 61.5
818818
}
819819

820820
@Test

0 commit comments

Comments
 (0)