Skip to content

Commit

Permalink
removed usage of minus in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jolanrensen committed Jan 27, 2025
1 parent 4e6753e commit e2c0cf7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ import org.jetbrains.kotlinx.dataframe.api.rename
import org.jetbrains.kotlinx.dataframe.api.reorderColumnsByName
import org.jetbrains.kotlinx.dataframe.api.replace
import org.jetbrains.kotlinx.dataframe.api.rows
import org.jetbrains.kotlinx.dataframe.api.schema
import org.jetbrains.kotlinx.dataframe.api.select
import org.jetbrains.kotlinx.dataframe.api.single
import org.jetbrains.kotlinx.dataframe.api.sortBy
Expand Down Expand Up @@ -189,7 +188,6 @@ import org.jetbrains.kotlinx.dataframe.size
import org.jetbrains.kotlinx.dataframe.type
import org.jetbrains.kotlinx.dataframe.typeClass
import org.junit.Test
import java.lang.reflect.Type
import java.math.BigDecimal
import java.time.LocalDate
import kotlin.reflect.jvm.jvmErasure
Expand Down Expand Up @@ -956,16 +954,9 @@ class DataFrameTests : BaseTest() {

fun check(body: () -> AnyFrame) = body().columnNames() shouldBe expected

check { typed - { age } }
check { typed - { it.age } }
check { typed.remove { age } }
check { typed.remove { it.age } }

check { df - { age } }
check { df - age }
check { df.remove(age) }

check { df - "age" }
check { df.remove("age") }
}

Expand All @@ -975,20 +966,14 @@ class DataFrameTests : BaseTest() {

fun check(body: () -> AnyFrame) = body().columnNames() shouldBe expected

check { typed - { age and weight } }
check { typed - { it.age and it.weight } }
check { typed - { age } - { weight } }
check { typed - { it.age } - { it.weight } }
check { typed.remove { age }.remove { weight } }
check { typed.remove { it.age }.remove { it.weight } }
check { typed.remove { age and weight } }
check { typed.remove { it.age and it.weight } }

check { df - { age and weight } }
check { df - age - weight }
check { df - { age } - { weight } }
check { df.remove(age, weight) }

check { df - { "age" and "weight" } }
check { df - "age" - "weight" }
check { df.remove { "age" and "weight" } }
check { df.remove { "age"() }.remove { "weight"() } }
check { df.remove("age", "weight") }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ import org.jetbrains.kotlinx.dataframe.api.map
import org.jetbrains.kotlinx.dataframe.api.max
import org.jetbrains.kotlinx.dataframe.api.maxBy
import org.jetbrains.kotlinx.dataframe.api.median
import org.jetbrains.kotlinx.dataframe.api.minus
import org.jetbrains.kotlinx.dataframe.api.move
import org.jetbrains.kotlinx.dataframe.api.moveTo
import org.jetbrains.kotlinx.dataframe.api.moveToLeft
Expand All @@ -87,7 +86,6 @@ import org.jetbrains.kotlinx.dataframe.api.sortBy
import org.jetbrains.kotlinx.dataframe.api.split
import org.jetbrains.kotlinx.dataframe.api.sumOf
import org.jetbrains.kotlinx.dataframe.api.toColumnAccessor
import org.jetbrains.kotlinx.dataframe.api.toDataFrame
import org.jetbrains.kotlinx.dataframe.api.toTop
import org.jetbrains.kotlinx.dataframe.api.under
import org.jetbrains.kotlinx.dataframe.api.ungroup
Expand Down Expand Up @@ -587,13 +585,13 @@ class DataFrameTreeTests : BaseTest() {

@Test
fun `join with left path`() {
val joined = (typed2 - { weight }).join(typed - { city }) { nameAndCity.name.match(right.name) and age }
val joined = typed2.remove { weight }.join(typed.remove { city }) { nameAndCity.name.match(right.name) and age }
joined shouldBe typed2
}

@Test
fun `join with right path`() {
val joined = (typed - { city }).join(typed2 - { weight }) { name.match(right.nameAndCity.name) and age }
val joined = typed.remove { city }.join(typed2.remove { weight }) { name.match(right.nameAndCity.name) and age }
val expected = typed.moveToRight { city }.move { city }.under("nameAndCity")
joined shouldBe expected
}
Expand All @@ -605,8 +603,8 @@ class DataFrameTreeTests : BaseTest() {
val grouped = typed.group { name and age }.into(nameAndAge).add(cityFirst) { city?.get(0) }
grouped[nameAndAge].columnsCount() shouldBe 3

val left = grouped - { weight }
val right = grouped - { city }
val left = grouped.remove { weight }
val right = grouped.remove { city }
val joined = left.join(right) { nameAndAge }
joined shouldBe grouped
}
Expand Down

0 comments on commit e2c0cf7

Please sign in to comment.