-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove copypasted code that unnecessarily created a new notebook file…
… away from the project
- Loading branch information
1 parent
393b3e3
commit ae3a300
Showing
1 changed file
with
15 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,25 @@ | ||
include("../utilities/prelude.jl") | ||
|
||
@testset "seeded random numbers are consistent across runs" begin | ||
mktempdir() do dir | ||
content = | ||
read(joinpath(@__DIR__, "../examples/random_seed/random_seed.qmd"), String) | ||
cd(dir) do | ||
server = QuartoNotebookRunner.Server() | ||
write("notebook.qmd", content) | ||
notebook = joinpath(@__DIR__, "../examples/random_seed/random_seed.qmd") | ||
|
||
jsons = map(1:2) do _ | ||
QuartoNotebookRunner.run!(server, "notebook.qmd"; showprogress = false) | ||
end | ||
server = QuartoNotebookRunner.Server() | ||
|
||
_output(cell) = only(cell.outputs).data["text/plain"] | ||
jsons = map(1:2) do _ | ||
QuartoNotebookRunner.run!(server, notebook; showprogress = false) | ||
end | ||
|
||
@test tryparse(Float64, _output(jsons[1].cells[2])) !== nothing | ||
@test tryparse(Float64, _output(jsons[1].cells[4])) !== nothing | ||
@test tryparse(Float64, _output(jsons[1].cells[6])) !== nothing | ||
_output(cell) = only(cell.outputs).data["text/plain"] | ||
|
||
@test length(unique([_output(jsons[1].cells[i]) for i in [2, 4, 6]])) == 3 | ||
@test tryparse(Float64, _output(jsons[1].cells[2])) !== nothing | ||
@test tryparse(Float64, _output(jsons[1].cells[4])) !== nothing | ||
@test tryparse(Float64, _output(jsons[1].cells[6])) !== nothing | ||
|
||
@test _output(jsons[1].cells[2]) == _output(jsons[2].cells[2]) | ||
@test _output(jsons[1].cells[4]) == _output(jsons[2].cells[4]) | ||
@test _output(jsons[1].cells[6]) == _output(jsons[2].cells[6]) | ||
@test length(unique([_output(jsons[1].cells[i]) for i in [2, 4, 6]])) == 3 | ||
|
||
close!(server) | ||
end | ||
end | ||
@test _output(jsons[1].cells[2]) == _output(jsons[2].cells[2]) | ||
@test _output(jsons[1].cells[4]) == _output(jsons[2].cells[4]) | ||
@test _output(jsons[1].cells[6]) == _output(jsons[2].cells[6]) | ||
|
||
close!(server) | ||
end |