Skip to content

Commit

Permalink
Merge pull request #90 from baumgold/observables
Browse files Browse the repository at this point in the history
bump Observables compat
  • Loading branch information
pfitzseb authored Nov 21, 2022
2 parents c1fabb3 + 112b6c1 commit b5634a5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
1 change: 0 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
fail-fast: false
matrix:
version:
- '1.0'
- '1'
- 'nightly'
os:
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ WebIO = "0f1e0344-ec1d-5b48-a673-e5cf874b6c29"
[compat]
JSExpr = "0.4, 0.5"
JSON = "0.18, 0.19, 0.20, 0.21"
Observables = "0.2, 0.3, 0.4"
Observables = "0.2, 0.3, 0.4, 0.5"
Tables = "1"
WebIO = "0.8"
julia = "0.7, 1"
Expand Down
15 changes: 9 additions & 6 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ end
@test showtable(nttable) isa WebIO.Scope
end
@testset "inf, nan, and missing serializing" begin
rows = Tables.table([NaN Inf -Inf 0 missing])
names = [:a, :b, :c, :d, :e]
rows = Tables.table([NaN Inf -Inf 0 missing]; header=names)
types = vcat([Float64 for _ in 1:4], [Missing])
Base.show(io::IO, x::Missing) = print(io, "test_missing")
json = TableView.table2json(Tables.Schema(names, types), rows, types)
schema = Tables.Schema(names, types)
json = TableView.table2json(schema, Tables.rows(rows), types)
firstrow = JSON.parse(json)[1]
@test firstrow["a"] == "NaN"
@test firstrow["b"] == "Inf"
Expand All @@ -33,20 +34,22 @@ end
@test firstrow["e"] == "test_missing"
end
@testset "large integers" begin
rows = Tables.table([2^52 2^53 2^54])
names = [:a, :b, :c]
rows = Tables.table([2^52 2^53 2^54]; header=names)
types = [Int64 for _ in 1:3]
json = TableView.table2json(Tables.Schema(names, types), rows, types)
schema = Tables.Schema(names, types)
json = TableView.table2json(schema, Tables.rows(rows), types)
firstrow = JSON.parse(json)[1]
@test firstrow["a"] == 4503599627370496
@test firstrow["b"] == "9007199254740992"
@test firstrow["c"] == "18014398509481984"
end
@testset "large floats" begin
rows = Tables.table([1.0e50 1.0e100])
names = [:a, :b]
rows = Tables.table([1.0e50 1.0e100]; header=names)
types = [Float64, Float64]
json = TableView.table2json(Tables.Schema(names, types), rows, types)
schema = Tables.Schema(names, types)
json = TableView.table2json(schema, Tables.rows(rows), types)
firstrow = JSON.parse(json)[1]
@test firstrow["a"] == "1.0e50"
@test firstrow["b"] == "1.0e100"
Expand Down

0 comments on commit b5634a5

Please sign in to comment.