Skip to content

Commit

Permalink
fix json memap in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierlabayle committed Dec 22, 2023
1 parent 375980d commit f8358ff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion test/outputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ end
TargetedEstimation.initialize_json(jsonoutput.filename)
TargetedEstimation.update_file(jsonoutput, results[1:3])
TargetedEstimation.update_file(jsonoutput, results[4:end]; finalize=true)
loaded_results = TMLE.read_json(jsonoutput.filename)
loaded_results = TMLE.read_json(jsonoutput.filename, use_mmap=false)
@test size(loaded_results) == size(results)
for (result, loaded_result) in zip(results, loaded_results)
@test result.TMLE.estimate == loaded_result[:TMLE].estimate
Expand Down
10 changes: 5 additions & 5 deletions test/runner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ include(joinpath(TESTDIR, "testutils.jl"))
TargetedEstimation.save(runner, results, partition, true)

# Test Save to JSON
loaded_results = TMLE.read_json(outputs.json.filename)
loaded_results = TMLE.read_json(outputs.json.filename, use_mmap=false)
for (result, loaded_result) in zip(results, loaded_results)
@test loaded_result[:TMLE] isa TMLE.TMLEstimate
@test result.TMLE.estimate == loaded_result[:TMLE].estimate
Expand Down Expand Up @@ -134,7 +134,7 @@ end
end
end
results_from_hdf5 = vcat(results_from_hdf5...)
results_from_json = TMLE.read_json(outputs.json.filename)
results_from_json = TMLE.read_json(outputs.json.filename, use_mmap=false)

for i in 1:6
Ψ = configuration.estimands[i]
Expand Down Expand Up @@ -171,7 +171,7 @@ end
)

# Essential results
results_from_json = TMLE.read_json("output.json")
results_from_json = TMLE.read_json("output.json", use_mmap=false)
n_IC_empties = 0
for result in results_from_json
if result[:OSE].IC != []
Expand Down Expand Up @@ -210,7 +210,7 @@ end
])

# Check results from JSON
results_from_json = TMLE.read_json(outputs.json.filename)
results_from_json = TMLE.read_json(outputs.json.filename, use_mmap=false)
for estimator in (:OSE, :TMLE)
@test results_from_json[1][estimator][:error] == "Could not fit the following propensity score model: P₀(T2 | W1, W2)"
@test results_from_json[1][estimator][:estimand] isa TMLE.Estimand
Expand Down Expand Up @@ -282,7 +282,7 @@ end
@test results[3].OSE isa TMLE.ComposedEstimate

# JSON Output
results_from_json = TMLE.read_json("output.json")
results_from_json = TMLE.read_json("output.json", use_mmap=false)
@test length(results_from_json) == 3

# HDF5
Expand Down
2 changes: 1 addition & 1 deletion test/summary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ include(joinpath(TESTDIR, "testutils.jl"))
hdf5file_2 = jldopen("tmle_output_2.hdf5")
inputs = vcat(hdf5file_1["Batch_1"], hdf5file_1["Batch_2"], hdf5file_2["Batch_1"])

json_outputs = TMLE.read_json("summary.json")
json_outputs = TMLE.read_json("summary.json", use_mmap=false)
jls_outputs = []
open("summary.jls") do io
while !eof(io)
Expand Down

0 comments on commit f8358ff

Please sign in to comment.