Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/standardkeys.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ See also: [`note!`](@ref)
"""
function note(table, column)
idx = column isa Union{Signed, Unsigned} ? Int(column) : Tables.columnindex(table, column)
idx == 0 && throw(ArgumentError("column $col not found in table"))
idx == 0 && throw(ArgumentError("column $column not found in table"))
if "note" in DataAPI.colmetadatakeys(table, column)
return string(DataAPI.colmetadata(table, column, "note"))
else
Expand Down
13 changes: 13 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ end
note!(df, :b, "three", append=true)
@test note(df, 2) == "two\nthree"
@test colmetadata(df, :b, "note", style=true) == ("two\nthree", :note)

for column in (:absent, "absent", 0, UInt8(0))
err = try
note(df, column)
catch exception
exception
end
@test err isa ArgumentError
@test sprint(showerror, err) == "ArgumentError: column $column not found in table"
end
@test note(df) == "two\nthree"
@test note(df, :b) == "two\nthree"
@test names(df) == ["a", "b", "c"]
end

@testset "unit, unit!, units" begin
Expand Down
Loading