@@ -2,6 +2,7 @@ package org.jetbrains.kotlinx.dataframe.api
2
2
3
3
import io.kotest.matchers.shouldBe
4
4
import io.kotest.matchers.shouldNotBe
5
+ import org.jetbrains.kotlinx.dataframe.alsoDebug
5
6
import org.jetbrains.kotlinx.dataframe.api.FormattingDsl.blue
6
7
import org.jetbrains.kotlinx.dataframe.api.FormattingDsl.red
7
8
import org.jetbrains.kotlinx.dataframe.api.FormattingDsl.rgb
@@ -312,4 +313,29 @@ class FormatTests : TestBase() {
312
313
html.split(" background-color:#00ff00" ).size - 1 shouldBe 5 // Only non-null weight values get formatted
313
314
formatted::class .simpleName shouldBe " FormattedFrame"
314
315
}
316
+
317
+ @Suppress(" ktlint:standard:argument-list-wrapping" )
318
+ @Test
319
+ fun `formatting a column shouldn't affect nested columns with the same name` () {
320
+ val df = dataFrameOf(" firstName" , " lastName" , " age" , " city" , " weight" , " isHappy" )(
321
+ " Alice" , " Cooper" , 15 , " London" , 54 , true ,
322
+ " Bob" , " Dylan" , 45 , " Dubai" , 87 , true ,
323
+ " Charlie" , " Daniels" , 20 , " Moscow" , null , false ,
324
+ " Charlie" , " Chaplin" , 40 , " Milan" , null , true ,
325
+ " Bob" , " Marley" , 30 , " Tokyo" , 68 , true ,
326
+ " Alice" , " Wolf" , 20 , null , 55 , false ,
327
+ " Charlie" , " Byrd" , 30 , " Moscow" , 90 , true ,
328
+ ).group(" firstName" , " lastName" ).into(" name" )
329
+ .groupBy(" city" ).toDataFrame()
330
+ .add(" cityCopy" ) { " city" <String >() }
331
+ .group(" city" ).into(" cityGroup" )
332
+ .rename(" cityCopy" ).into(" city" )
333
+
334
+ df.alsoDebug()
335
+
336
+ df.format().with { background(black) }.toStandaloneHtml().openInBrowser()
337
+
338
+ // affects city, cityGroup.city, and group[*].city
339
+ df.format(" city" ).with { bold and italic and textColor(green) }.toStandaloneHtml().openInBrowser()
340
+ }
315
341
}
0 commit comments