-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7868be0
commit 68cc983
Showing
5 changed files
with
77 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using Query | ||
using DataFrames | ||
using Base.Test | ||
|
||
@testset "Standalone Syntax" begin | ||
|
||
@testset "@take operator" begin | ||
df = DataFrame(a=[1,2,3], b=[3.,2.,1.], c=["a", "b", "c"]) | ||
|
||
df2 = df |> @take(2) |> DataFrame | ||
|
||
@test df2 isa DataFrame | ||
@test size(df2) == (2,3) | ||
@test df2[:a] == [1,2] | ||
@test df2[:b] == [3.,2.] | ||
@test df2[:c] == ["a", "b"] | ||
|
||
df2 = DataFrame(@take(df, 2)) | ||
|
||
@test df2 isa DataFrame | ||
@test size(df2) == (2,3) | ||
@test df2[:a] == [1,2] | ||
@test df2[:b] == [3.,2.] | ||
@test df2[:c] == ["a", "b"] | ||
end | ||
|
||
@testset "@drop operator" begin | ||
df = DataFrame(a=[1,2,3], b=[3.,2.,1.], c=["a", "b", "c"]) | ||
|
||
df2 = df |> @drop(1) |> DataFrame | ||
|
||
@test df2 isa DataFrame | ||
@test size(df2) == (2,3) | ||
@test df2[:a] == [2,3] | ||
@test df2[:b] == [2.,1.] | ||
@test df2[:c] == ["b","c"] | ||
|
||
df2 = DataFrame(@drop(df, 1)) | ||
|
||
@test df2 isa DataFrame | ||
@test size(df2) == (2,3) | ||
@test df2[:a] == [2,3] | ||
@test df2[:b] == [2.,1.] | ||
@test df2[:c] == ["b","c"] | ||
end | ||
|
||
end |