Skip to content

Commit

Permalink
Merge pull request #12 from queryverse/create-pull-request/patch
Browse files Browse the repository at this point in the history
[AUTO] Format files using DocumentFormat
  • Loading branch information
davidanthoff authored Aug 22, 2020
2 parents d54319f + f524f50 commit f50001e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using Documenter, DataTables

makedocs(
modules = [DataTables],
sitename = "DataTables.jl",
analytics = "UA-132838790-1",
pages = [
modules=[DataTables],
sitename="DataTables.jl",
analytics="UA-132838790-1",
pages=[
"Introduction" => "index.md"
]
)

deploydocs(
repo = "github.com/queryverse/DataTables.jl.git"
repo="github.com/queryverse/DataTables.jl.git"
)
6 changes: 3 additions & 3 deletions src/DataTables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct DataTable{T,TCOLS} <: AbstractVector{T}
end

function fromNT(nt)
nt = map(i->i isa ReadOnlyArrays.ReadOnlyArray ? i : ReadOnlyArrays.ReadOnlyArray(i), nt)
nt = map(i -> i isa ReadOnlyArrays.ReadOnlyArray ? i : ReadOnlyArrays.ReadOnlyArray(i), nt)
tx = typeof(nt)
et = NamedTuple{propertynames(nt),Tuple{(eltype(fieldtype(tx, i)) for i in 1:fieldcount(typeof(nt)))...}}
return DataTable{et,typeof(nt)}(nt)
Expand All @@ -21,7 +21,7 @@ swap_dva_in(A) = A
swap_dva_in(A::Array{<:DataValue}) = DataValueArray(A)

function DataTable(;cols...)
return fromNT(map(col->swap_dva_in(col), values(cols)))
return fromNT(map(col -> swap_dva_in(col), values(cols)))
end

function DataTable(table)
Expand Down Expand Up @@ -49,7 +49,7 @@ end

@inline function Base.getindex(dt::DataTable{T}, i::Int) where {T}
@boundscheck checkbounds(dt, i)
return map(col->@inbounds(getindex(col, i)), columns(dt))
return map(col -> @inbounds(getindex(col, i)), columns(dt))
end

function Base.show(io::IO, dt::DataTable)
Expand Down
8 changes: 4 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using Test

@testset "DataTables" begin

dt1 = DataTable(a = [1,2,3], b = [4.,5.,6.], c = ["John", "Sally", "Jim"])
dt1 = DataTable(a=[1,2,3], b=[4.,5.,6.], c=["John", "Sally", "Jim"])

@testset "Core" begin

Expand Down Expand Up @@ -31,13 +31,13 @@ using Test
@test sprint(show, dt1) ==
"3x3 DataTable\na │ b │ c \n──┼─────┼──────\n1 │ 4.0 │ John \n2 │ 5.0 │ Sally\n3 │ 6.0 │ Jim "

@test sprint((stream, data)->show(stream, "text/plain", data), dt1) ==
@test sprint((stream, data) -> show(stream, "text/plain", data), dt1) ==
"3x3 DataTable\na │ b │ c \n──┼─────┼──────\n1 │ 4.0 │ John \n2 │ 5.0 │ Sally\n3 │ 6.0 │ Jim "

@test sprint((stream, data)->show(stream, "text/html", data), dt1) ==
@test sprint((stream, data) -> show(stream, "text/html", data), dt1) ==
"<table><thead><tr><th>a</th><th>b</th><th>c</th></tr></thead><tbody><tr><td>1</td><td>4.0</td><td>&quot;John&quot;</td></tr><tr><td>2</td><td>5.0</td><td>&quot;Sally&quot;</td></tr><tr><td>3</td><td>6.0</td><td>&quot;Jim&quot;</td></tr></tbody></table>"

@test sprint((stream, data)->show(stream, "application/vnd.dataresource+json", data), dt1) ==
@test sprint((stream, data) -> show(stream, "application/vnd.dataresource+json", data), dt1) ==
"{\"schema\":{\"fields\":[{\"name\":\"a\",\"type\":\"integer\"},{\"name\":\"b\",\"type\":\"number\"},{\"name\":\"c\",\"type\":\"string\"}]},\"data\":[{\"a\":1,\"b\":4.0,\"c\":\"John\"},{\"a\":2,\"b\":5.0,\"c\":\"Sally\"},{\"a\":3,\"b\":6.0,\"c\":\"Jim\"}]}"

@test showable("text/html", dt1) == true
Expand Down

0 comments on commit f50001e

Please sign in to comment.