|
20 | 20 | @test showtable(nttable) isa WebIO.Scope |
21 | 21 | end |
22 | 22 | @testset "inf, nan, and missing serializing" begin |
23 | | - rows = Tables.table([NaN Inf -Inf 0 missing]) |
24 | 23 | names = [:a, :b, :c, :d, :e] |
| 24 | + rows = Tables.table([NaN Inf -Inf 0 missing]; header=names) |
25 | 25 | types = vcat([Float64 for _ in 1:4], [Missing]) |
26 | 26 | Base.show(io::IO, x::Missing) = print(io, "test_missing") |
27 | | - json = TableView.table2json(Tables.Schema(names, types), rows, types) |
| 27 | + schema = Tables.Schema(names, types) |
| 28 | + json = TableView.table2json(schema, Tables.rows(rows), types) |
28 | 29 | firstrow = JSON.parse(json)[1] |
29 | 30 | @test firstrow["a"] == "NaN" |
30 | 31 | @test firstrow["b"] == "Inf" |
|
33 | 34 | @test firstrow["e"] == "test_missing" |
34 | 35 | end |
35 | 36 | @testset "large integers" begin |
36 | | - rows = Tables.table([2^52 2^53 2^54]) |
37 | 37 | names = [:a, :b, :c] |
| 38 | + rows = Tables.table([2^52 2^53 2^54]; header=names) |
38 | 39 | types = [Int64 for _ in 1:3] |
39 | | - json = TableView.table2json(Tables.Schema(names, types), rows, types) |
| 40 | + schema = Tables.Schema(names, types) |
| 41 | + json = TableView.table2json(schema, Tables.rows(rows), types) |
40 | 42 | firstrow = JSON.parse(json)[1] |
41 | 43 | @test firstrow["a"] == 4503599627370496 |
42 | 44 | @test firstrow["b"] == "9007199254740992" |
43 | 45 | @test firstrow["c"] == "18014398509481984" |
44 | 46 | end |
45 | 47 | @testset "large floats" begin |
46 | | - rows = Tables.table([1.0e50 1.0e100]) |
47 | 48 | names = [:a, :b] |
| 49 | + rows = Tables.table([1.0e50 1.0e100]; header=names) |
48 | 50 | types = [Float64, Float64] |
49 | | - json = TableView.table2json(Tables.Schema(names, types), rows, types) |
| 51 | + schema = Tables.Schema(names, types) |
| 52 | + json = TableView.table2json(schema, Tables.rows(rows), types) |
50 | 53 | firstrow = JSON.parse(json)[1] |
51 | 54 | @test firstrow["a"] == "1.0e50" |
52 | 55 | @test firstrow["b"] == "1.0e100" |
|
0 commit comments