|
261 | 261 | 4 │ true true true |
262 | 262 | 5 │ true true true""" |
263 | 263 |
|
264 | | - show(io, groupby(df, :x), allcols=true, allrows=true) |
| 264 | + show(io, groupby(df, :x), allcols=true, allrows=true) |
265 | 265 | str = String(take!(io.io)) |
266 | 266 | @test str == """ |
267 | 267 | GroupedDataFrame with 2 groups based on key: x |
@@ -336,22 +336,35 @@ end |
336 | 336 | end |
337 | 337 |
|
338 | 338 | # printed height always matches desired height, above a reasonable minimum |
339 | | - for h in 15:40 |
| 339 | + for a in 1:50, b in 1:50, h in 15:40 |
| 340 | + df = DataFrame(x = [fill(1, a); fill(2, b)]) |
340 | 341 | io = IOContext(IOBuffer(), :displaysize=>(h, 40), :limit=>true) |
341 | 342 | show(io, groupby(df, :x), allcols=true) |
342 | 343 | str = String(take!(io.io)) |
343 | 344 | nlines = length(split(str, '\n')) |
344 | | - desired = h - 3 # leave one line for last REPL prompt at top, two for new prompt |
| 345 | + # leave one line for last REPL prompt at top, two for new prompt |
345 | 346 | # (this is the same behavior as ungrouped data frames) |
| 347 | + desired = min(a + b + 10, h - 3) |
| 348 | + @test nlines == desired |
| 349 | + end |
| 350 | + |
| 351 | + for a in 1:50, h in 15:40 |
| 352 | + df = DataFrame(x = fill(1, a)) |
| 353 | + io = IOContext(IOBuffer(), :displaysize=>(h, 40), :limit=>true) |
| 354 | + show(io, groupby(df, :x), allcols=true) |
| 355 | + str = String(take!(io.io)) |
| 356 | + nlines = length(split(str, '\n')) |
| 357 | + # leave one line for last REPL prompt at top, two for new prompt |
| 358 | + # (this is the same behavior as ungrouped data frames) |
| 359 | + desired = min(a + 5, h - 3) |
346 | 360 | @test nlines == desired |
347 | 361 | end |
348 | 362 |
|
349 | 363 | # one group |
350 | 364 | io = IOContext(IOBuffer(), :displaysize=>(15, 40), :limit=>true) |
351 | | - df = DataFrame(x = 1:15, y = 1) |
| 365 | + df = DataFrame(x = Int64.(1:15), y = Int64(1)) |
352 | 366 | show(io, groupby(df, :y)) |
353 | 367 | str = String(take!(io.io)) |
354 | | - print(str) |
355 | 368 | @test str == """ |
356 | 369 | GroupedDataFrame with 1 group based on key: y |
357 | 370 | First Group (15 rows): y = 1 |
|
0 commit comments