Skip to content

Commit

Permalink
tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
pdeffebach committed Jul 7, 2021
1 parent 012fcfd commit 227a261
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
4 changes: 2 additions & 2 deletions test/dataframes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ s = [:i, :g]
@test_throws LoadError @eval @transform(df, Not([:i, :g]))
@test_throws MethodError @eval @transform(df, :n = sum(Between(:i, :t)))
@test_throws ArgumentError @eval @transform(df, :n = sum(cols(s)))
@test_throws ArgumentError @eval @transform(df, y = :i + cols(1))
@test_throws ArgumentError @eval @transform(df, :y = :i + cols(1))
end

@testset "@select" begin
Expand Down Expand Up @@ -554,7 +554,7 @@ cr = "c"
@test_throws LoadError @eval @select(df, Not([:i, :g]))
@test_throws MethodError @eval @select(df, :n = sum(Between(:i, :t)))
@test_throws ArgumentError @eval @select(df, :n = sum(cols(s)))
@test_throws ArgumentError @eval @select(df, y = :i + cols(1))
@test_throws ArgumentError @eval @select(df, :y = :i + cols(1))
end

@testset "Keyword arguments failure" begin
Expand Down
42 changes: 42 additions & 0 deletions test/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,46 @@ end
@test @where(gd, :c .== :g) df[[], :]
end

@testset "Unquoted symbols on LHS" begin
df = DataFrame(
g = [1, 1, 1, 2, 2],
i = 1:5,
t = ["a", "b", "c", "c", "e"],
y = [:v, :w, :x, :y, :z],
c = [:g, :quote, :body, :transform, missing]
)

gd = groupby(df, :g)

newdf = @transform df :n = :i

@test (@transform df n = :i) newdf
@test (@transform(df, n = identity(:i))) newdf
@test (@transform df @byrow n = :i) newdf
d = @transform df begin
n = identity(:i)
end
@test d newdf

d = @eachrow df begin
@newcol n::Vector{Int}
:n = :i
end
@test d newdf

newdf = @select df :n = :i

@test (@select df n = :i) newdf
@test (@select(df, n = identity(:i))) newdf
d = @select df begin
n = identity(:i)
end
@test (@select df @byrow n = :i) newdf
@test d newdf

newdf = @combine gd :n = first(:i)
@test (@combine gd n = first(:i)) newdf
@test (@combine(gd, n = first(:i))) newdf
end

end # module
2 changes: 1 addition & 1 deletion test/function_compilation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ using DataFramesMeta

gd = groupby(df, :a)

@test @combine(gd, testnt(:b)) == DataFrame(a = [1], :c = [2])
@test @combine(gd, testnt(:b)) == DataFrame(a = [1], c = [2])

fasttime = @timed @combine(gd, testnt(:b))
slowtime = @timed combine(gd, :b => (b -> testnt(b)) => AsTable)
Expand Down

0 comments on commit 227a261

Please sign in to comment.