Skip to content

Commit

Permalink
minor test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
montyvesselinov committed Aug 18, 2024
1 parent 40b8355 commit b5b6bd4
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion examples/anasol/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ Test.@testset "Anasol" begin
Test.@test isapprox(good_residuals, residuals_results, atol=1e-8)

# Test Mads.getsourcekeys(md)
Test.@test sk == ["Source1_dz", "Source1_f", "Source1_t0", "Source1_x", "Source1_dy", "Source1_dx", "Source1_z", "Source1_t1", "Source1_y"]
Test.@test sk == ["Source1_x", "Source1_y", "Source1_z", "Source1_dx", "Source1_dy", "Source1_dz", "Source1_f", "Source1_t0", "Source1_t1"]

# Test Mads.getparamsmin(md), getparamsmax, getparamsinit_min, getparamsinit_max
Test.@test isapprox(m1, good_params_min, atol=1e-8)
Expand Down
4 changes: 3 additions & 1 deletion examples/contamination/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ end
Mads.@stdouterrcapture Mads.addsource!(md)
Mads.@stdouterrcapture Mads.removesource!(md)

Mads.rmdir("w01-w13a_w20a_restart")
Mads.rmfile(joinpath(workdir, "w01-w13a_w20a-match.svg"))
Mads.rmfile(joinpath(workdir,"w01-w13a_w20a.initialresults"))
Mads.rmfile(joinpath(workdir,"w01-w13a_w20a_saltelli_5.jld2"))

Mads.veryquietoff()
Mads.graphon()
Expand Down
3 changes: 0 additions & 3 deletions examples/contamination/w01-w13a_w20a.initialresults

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions src/MadsIO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -262,21 +262,21 @@ Example:
md = Mads.loadmadsfile("input_file_name.mads")
```
"""
function loadmadsfile(filename::AbstractString; bigfile::Bool=false, format::AbstractString="yaml", quiet::Bool=Mads.quiet)
function loadmadsfile(filename::AbstractString; bigfile::Bool=false, format::AbstractString="yaml", quiet::Bool=Mads.quiet, dicttype=OrderedCollections.OrderedDict{Any,Any})
if bigfile
madsdata = loadbigyamlfile(filename)
end
if !bigfile || isnothing(madsdata)
if format == "yaml"
madsdata = loadyamlfile(filename)
madsdata = loadyamlfile(filename; dicttype=dicttype)
elseif format == "json"
madsdata = loadjsonfile(filename)
end
end
while typeof(madsdata) <: AbstractString # Windows links fix
filename = joinpath(splitdir(filename)[1], madsdata)
if format == "yaml"
madsdata = loadyamlfile(filename)
madsdata = loadyamlfile(filename; dicttype=dicttype)
elseif format == "json"
madsdata = loadjsonfile(filename)
end
Expand Down
4 changes: 2 additions & 2 deletions src/MadsYAML.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Returns:
- data in the yaml input file
"""
function loadyamlfile(filename::AbstractString)
yamldata = YAML.load_file(filename; dicttype=OrderedCollections.OrderedDict{String,Any})
function loadyamlfile(filename::AbstractString; dicttype=OrderedCollections.OrderedDict{Any,Any})
yamldata = YAML.load_file(filename; dicttype=dicttype)
return yamldata
end

Expand Down

0 comments on commit b5b6bd4

Please sign in to comment.