-
Notifications
You must be signed in to change notification settings - Fork 55
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
5afe511
commit 1d33e61
Showing
3 changed files
with
156 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
module TestMetaData | ||
|
||
using Test | ||
|
||
@testset "labels" begin | ||
df = DataFrame(a = 1, b = 2) | ||
@label! df :a = "alab" | ||
@test labels(df) == ["alab", "b"] | ||
|
||
df = DataFrame(a = 1, b = 2) | ||
@label! df begin | ||
:a = "alab" | ||
:b = "blab" | ||
end | ||
@test labels(df) == ["alab", "blab"] | ||
|
||
df_new = leftjoin(DataFrame(a = 1, c = 2), df, on = :a) | ||
@test labels(df_new) == ["a", "c", "blab"] | ||
|
||
df_new = @rename df :a2 = :a | ||
@test labels(df_new) == ["alab", "blab"] | ||
|
||
df_new = @rtransform df :a = :a + 1 | ||
@test labels(df_new) == ["alab", "blab"] | ||
end | ||
|
||
@testset "notes" begin | ||
df = DataFrame(a = 1, b = 2) | ||
@note! df :a = "anote" | ||
@test note(df, :a) == "anote" | ||
|
||
@note! df :a = "anote2" | ||
@test note(df, :a) == "anote\nanote2" | ||
|
||
df = DataFrame(a = 1, b = 2) | ||
@note! df begin | ||
:a = "anote" | ||
:b = "bnote" | ||
end | ||
@test note(df, :a) == "anote" | ||
@test note(df, :b) == "bnote" | ||
|
||
df_new = leftjoin(DataFrame(a = 1, c = 2), df, on = :a) | ||
@test note(df_new, :a) == "" | ||
@test note(df_new, :b) == "bnote" | ||
|
||
df_new = @rename df :a2 = :a | ||
@test note(df_new, :a2) == "anote" | ||
@test note(df_new, :b) == "bnote" | ||
|
||
df_new = @rtransform df :a = :a + 1 | ||
@test note(df_new, :a) == "anote" | ||
@test note(df_new, :b) == "bnote" | ||
end | ||
|
||
|
||
|
||
end # module |