fixed tests

This commit is contained in:
Thomas Breloff 2015-09-23 13:03:37 -04:00
parent a207856e99
commit 33602aca11
5 changed files with 16 additions and 4 deletions

View File

@ -236,7 +236,7 @@ function buildReadme()
# build keyword arg table # build keyword arg table
table = "Keyword | Default | Type | Aliases \n---- | ---- | ---- | ----\n" table = "Keyword | Default | Type | Aliases \n---- | ---- | ---- | ----\n"
for d in (Plots._seriesDefaults, Plots._plotDefaults) for d in (Plots._seriesDefaults, Plots._plotDefaults)
for k in sort(collect(keys(d))) for k in sortedkeys(d)
aliasstr = createStringOfMarkDownSymbols(aliases(Plots._keyAliases, k)) aliasstr = createStringOfMarkDownSymbols(aliases(Plots._keyAliases, k))
table = string(table, "`:$k` | `$(d[k])` | $(d==Plots._seriesDefaults ? "Series" : "Plot") | $aliasstr \n") table = string(table, "`:$k` | `$(d[k])` | $(d==Plots._seriesDefaults ? "Series" : "Plot") | $aliasstr \n")
end end

View File

@ -153,7 +153,7 @@ end
function aliases(aliasMap::Dict, val) function aliases(aliasMap::Dict, val)
# sort(vcat(val, collect(keys(filter((k,v)-> v==val, aliasMap))))) # sort(vcat(val, collect(keys(filter((k,v)-> v==val, aliasMap)))))
sort(collect(keys(filter((k,v)-> v==val, aliasMap)))) sortedkeys(filter((k,v)-> v==val, aliasMap))
end end
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@ -247,6 +247,13 @@ end
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
function warnOnUnsupportedArgs(pkg::PlottingPackage, d::Dict)
for k in sortedkeys(d)
if !(k in supportedArgs(pkg))
warn("Keyword argument $k not supported with $pkg. Choose from: $(supportedArgs(pkg))")
end
end
end
function warnOnUnsupported(pkg::PlottingPackage, d::Dict) function warnOnUnsupported(pkg::PlottingPackage, d::Dict)

View File

@ -81,6 +81,8 @@ function plot!(plt::Plot, args...; kw...)
d = Dict(kw) d = Dict(kw)
replaceAliases!(d, _keyAliases) replaceAliases!(d, _keyAliases)
warnOnUnsupportedArgs(plt.plotter, d)
# TODO: handle a "group by" mechanism. # TODO: handle a "group by" mechanism.
# will probably want to check for the :group kw param, and split into # will probably want to check for the :group kw param, and split into
# index partitions/filters to be passed through to the next step. # index partitions/filters to be passed through to the next step.

View File

@ -118,6 +118,9 @@ function replaceAliases!(d::Dict, aliases::Dict)
end end
sortedkeys(d::Dict) = sort(collect(keys(d)))
function regressionXY(x, y) function regressionXY(x, y)
# regress # regress
β, α = [x ones(length(x))] \ y β, α = [x ones(length(x))] \ y

View File

@ -13,7 +13,7 @@ try
facts("Gadfly") do facts("Gadfly") do
@fact plotter!(:gadfly) --> Plots.GadflyPackage() @fact plotter!(:gadfly) --> Plots.GadflyPackage()
@fact plotter() --> Plots.GadflyPackage() @fact plotter() --> Plots.GadflyPackage()
@fact typeof(plot(1:10)) --> Plots.Plot @fact typeof(plot(1:10)) --> Plots.Plot{Plots.GadflyPackage}
# plot(x::AVec, y::AVec; kw...) # one line (will assert length(x) == length(y)) # plot(x::AVec, y::AVec; kw...) # one line (will assert length(x) == length(y))
@ -43,7 +43,7 @@ try
facts("Qwt") do facts("Qwt") do
@fact plotter!(:qwt) --> Plots.QwtPackage() @fact plotter!(:qwt) --> Plots.QwtPackage()
@fact plotter() --> Plots.QwtPackage() @fact plotter() --> Plots.QwtPackage()
@fact typeof(plot(1:10)) --> Plots.Plot @fact typeof(plot(1:10)) --> Plots.Plot{Plots.QwtPackage}
# plot(y::AVec; kw...) # one line... x = 1:length(y) # plot(y::AVec; kw...) # one line... x = 1:length(y)
@fact plot(1:10) --> not(nothing) @fact plot(1:10) --> not(nothing)