From 9fab331897619b47c4267bbbff4e33de3df1713a Mon Sep 17 00:00:00 2001 From: Joshua Gentry Date: Wed, 26 Oct 2022 10:19:09 -0400 Subject: [PATCH 1/2] Updated for Julia 1.8. --- .github/workflows/Documentation.yaml | 2 +- Project.toml | 6 +- src/leptonica/pix/rw_bmp.jl | 2 +- src/leptonica/pix/rw_gif.jl | 2 +- src/leptonica/pix/rw_jp2k.jl | 8 +- src/leptonica/pix/rw_pam.jl | 2 +- src/leptonica/pix/rw_pdf.jl | 2 +- src/leptonica/pix/rw_png.jl | 2 +- src/leptonica/pix/rw_pnm.jl | 2 +- src/leptonica/pix/rw_ps.jl | 6 +- src/leptonica/pix/rw_spix.jl | 2 +- src/tesseract/datafiles/languages.jl | 6 +- src/tesseract/tess_inst_config_vars.jl | 6 +- src/tesseract/tess_inst_output_tsv.jl | 2 +- test/leptonica/pix/bmp.jl | 12 +-- test/leptonica/pix/common.jl | 2 +- test/leptonica/pix/gif.jl | 18 ++-- test/leptonica/pix/jp2k.jl | 60 +++++++------- test/leptonica/pix/jpeg.jl | 54 ++++++------ test/leptonica/pix/pam.jl | 2 +- test/leptonica/pix/pdf.jl | 10 +-- test/leptonica/pix/png.jl | 24 +++--- test/leptonica/pix/pnm.jl | 10 +-- test/leptonica/pix/ps.jl | 10 +-- test/leptonica/pix/read.jl | 36 ++++---- test/leptonica/pix/spix.jl | 20 ++--- test/leptonica/pix/tiff.jl | 86 ++++++++++---------- test/leptonica/pix/webp.jl | 28 +++---- test/leptonica/pix/write.jl | 4 +- test/leptonica/pix_sanity.jl | 4 +- test/tesseract/tess_inst_config.jl | 8 +- test/tesseract/tess_inst_output.jl | 70 ++++++++-------- test/tesseract/tess_output.jl | 2 +- test/tesseract/tess_pipeline_alto.jl | 2 +- test/tesseract/tess_pipeline_hocr.jl | 2 +- test/tesseract/tess_pipeline_lstm_box.jl | 2 +- test/tesseract/tess_pipeline_pdf.jl | 2 +- test/tesseract/tess_pipeline_text.jl | 2 +- test/tesseract/tess_pipeline_unlv.jl | 4 +- test/tesseract/tess_run_pipeline_callback.jl | 8 +- test/tesseract/tess_run_pipeline_filename.jl | 2 +- 41 files changed, 267 insertions(+), 267 deletions(-) diff --git a/.github/workflows/Documentation.yaml b/.github/workflows/Documentation.yaml index 712d2a4..e6a56f4 100644 --- a/.github/workflows/Documentation.yaml +++ b/.github/workflows/Documentation.yaml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@latest with: - version: 1.6 + version: 1.8 - name: Install dependencies run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' - name: Build and deploy diff --git a/Project.toml b/Project.toml index 42e8db0..e71f691 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Tesseract" uuid = "11879493-52b3-4e20-990d-281c54a395a1" authors = ["Joshua Gentry "] -version = "0.4.0" +version = "0.4.1" [deps] Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" @@ -14,8 +14,8 @@ SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce" Tesseract_jll = "efd95c89-babc-5260-8753-618084eaf9d7" [compat] -HTTP = "0.9" +HTTP = "1.5" JSON = "0.21" Leptonica_jll = "1.82.0" Tesseract_jll = "5.1.0" -julia = "1.6" +julia = "1.8" diff --git a/src/leptonica/pix/rw_bmp.jl b/src/leptonica/pix/rw_bmp.jl index c2ffc9c..8b6624c 100644 --- a/src/leptonica/pix/rw_bmp.jl +++ b/src/leptonica/pix/rw_bmp.jl @@ -199,7 +199,7 @@ function pix_write_bmp( finally lept_free(data) - if file != nothing + if file !== nothing close(file) end end diff --git a/src/leptonica/pix/rw_gif.jl b/src/leptonica/pix/rw_gif.jl index 3a965af..be87c60 100644 --- a/src/leptonica/pix/rw_gif.jl +++ b/src/leptonica/pix/rw_gif.jl @@ -199,7 +199,7 @@ function pix_write_gif( finally lept_free(data) - if file != nothing + if file !== nothing close(file) end end diff --git a/src/leptonica/pix/rw_jp2k.jl b/src/leptonica/pix/rw_jp2k.jl index ef45493..3f50d6c 100644 --- a/src/leptonica/pix/rw_jp2k.jl +++ b/src/leptonica/pix/rw_jp2k.jl @@ -58,7 +58,7 @@ function pix_read_jp2k( end # If a box was provided allocate a box. - if box != nothing + if box !== nothing boxPtr = ccall( (:boxCreate, LEPTONICA), Ptr{Cvoid}, @@ -67,7 +67,7 @@ function pix_read_jp2k( ) end - if box != nothing && boxPtr == C_NULL + if box !== nothing && boxPtr == C_NULL return nothing end @@ -177,7 +177,7 @@ function pix_read_jp2k( end # If a box was provided allocate a box. - if box != nothing + if box !== nothing boxPtr = ccall( (:boxCreate, LEPTONICA), Ptr{Cvoid}, @@ -186,7 +186,7 @@ function pix_read_jp2k( ) end - if box != nothing && boxPtr == C_NULL + if box !== nothing && boxPtr == C_NULL return nothing end diff --git a/src/leptonica/pix/rw_pam.jl b/src/leptonica/pix/rw_pam.jl index 8a84194..2d09aa7 100644 --- a/src/leptonica/pix/rw_pam.jl +++ b/src/leptonica/pix/rw_pam.jl @@ -109,7 +109,7 @@ function pix_write_pam( finally lept_free(data) - if file != nothing + if file !== nothing close(file) end end diff --git a/src/leptonica/pix/rw_pdf.jl b/src/leptonica/pix/rw_pdf.jl index 56165d9..650cd99 100644 --- a/src/leptonica/pix/rw_pdf.jl +++ b/src/leptonica/pix/rw_pdf.jl @@ -138,7 +138,7 @@ function pix_write_pdf( finally lept_free(data) - if file != nothing + if file !== nothing close(file) end end diff --git a/src/leptonica/pix/rw_png.jl b/src/leptonica/pix/rw_png.jl index 0c03a97..dc122e8 100644 --- a/src/leptonica/pix/rw_png.jl +++ b/src/leptonica/pix/rw_png.jl @@ -215,7 +215,7 @@ function pix_write_png( finally lept_free(data) - if file != nothing + if file !== nothing close(file) end end diff --git a/src/leptonica/pix/rw_pnm.jl b/src/leptonica/pix/rw_pnm.jl index 0e38277..0e72fbe 100644 --- a/src/leptonica/pix/rw_pnm.jl +++ b/src/leptonica/pix/rw_pnm.jl @@ -192,7 +192,7 @@ function pix_write_pnm( finally lept_free(data) - if file != nothing + if file !== nothing close(file) end end diff --git a/src/leptonica/pix/rw_ps.jl b/src/leptonica/pix/rw_ps.jl index 59f59d0..c854e5a 100644 --- a/src/leptonica/pix/rw_ps.jl +++ b/src/leptonica/pix/rw_ps.jl @@ -92,7 +92,7 @@ function pix_write_ps_i( # --------------------------------------------------------------------------------------------- # If a box was provided allocate a box. - if box != nothing + if box !== nothing boxPtr = ccall( (:boxCreate, LEPTONICA), Ptr{Cvoid}, @@ -101,7 +101,7 @@ function pix_write_ps_i( ) end - if box != nothing && boxPtr == C_NULL + if box !== nothing && boxPtr == C_NULL return (C_NULL, 0) end @@ -206,7 +206,7 @@ function pix_write_ps( finally lept_free(data) - if file != nothing + if file !== nothing close(file) end end diff --git a/src/leptonica/pix/rw_spix.jl b/src/leptonica/pix/rw_spix.jl index 6163768..f3a4543 100644 --- a/src/leptonica/pix/rw_spix.jl +++ b/src/leptonica/pix/rw_spix.jl @@ -189,7 +189,7 @@ function pix_write_spix( finally lept_free(data) - if file != nothing + if file !== nothing close(file) end end diff --git a/src/tesseract/datafiles/languages.jl b/src/tesseract/datafiles/languages.jl index 0cf89e1..aabe25a 100644 --- a/src/tesseract/datafiles/languages.jl +++ b/src/tesseract/datafiles/languages.jl @@ -324,9 +324,9 @@ function parse_languages( local files = get_json_safe(AbstractVector, json, "files") version === nothing && return Languages() - lastcheck == nothing && return Languages() - server == nothing && return Languages() - files == nothing && return Languages() + lastcheck === nothing && return Languages() + server === nothing && return Languages() + files === nothing && return Languages() # ------------------------------------------------------------------------------------- # Check the version. diff --git a/src/tesseract/tess_inst_config_vars.jl b/src/tesseract/tess_inst_config_vars.jl index 463dc34..277ce22 100644 --- a/src/tesseract/tess_inst_config_vars.jl +++ b/src/tesseract/tess_inst_config_vars.jl @@ -87,9 +87,9 @@ function TessParam( local debug = findfirst("debug", name) !== nothing || findfirst("display", name) !== nothing - if match(r"^-?[0-9]+\.[0-9]+$", value) != nothing + if match(r"^-?[0-9]+\.[0-9]+$", value) !== nothing return TessParam{Float64}(name, parse(Float64, value), help, debug) - elseif match(r"^-?[0-9]+$", value) != nothing + elseif match(r"^-?[0-9]+$", value) !== nothing return TessParam{Int32}(name, parse(Int32, value), help, debug) else return TessParam{String}(name, value, help, debug) @@ -131,7 +131,7 @@ function tess_params_parsed( local params = Vector{TessParam}() local data = tess_params(inst) - if data != nothing + if data !== nothing for m in eachmatch(r"([a-z0-9_]+)\t([^\t]*)\t([^\n]+)"sm, data) local name, value, help = m.captures push!(params, TessParam(name, value, help)) diff --git a/src/tesseract/tess_inst_output_tsv.jl b/src/tesseract/tess_inst_output_tsv.jl index 8ad9d15..f4ed548 100644 --- a/src/tesseract/tess_inst_output_tsv.jl +++ b/src/tesseract/tess_inst_output_tsv.jl @@ -233,7 +233,7 @@ function tess_parsed_tsv( )::Union{Vector{Tsv}, Nothing} local text = tess_tsv(inst, page) - if text == nothing + if text === nothing return nothing end diff --git a/test/leptonica/pix/bmp.jl b/test/leptonica/pix/bmp.jl index cda82fb..9745fa5 100644 --- a/test/leptonica/pix/bmp.jl +++ b/test/leptonica/pix/bmp.jl @@ -27,7 +27,7 @@ local original = pix_write_pam(pix) function unchanged(test) - test != nothing && pix_write_pam(test) == original + test !== nothing && pix_write_pam(test) == original end # --------------------------------------------------------------------------------------------- @@ -70,19 +70,19 @@ end # ----------------------------------------------------------------------------------------- # From a file. local filename = safe_tmp_file() - @test pix_read_bmp(filename) == nothing - @test pix_read_bmp("xyzzy.bmp") == nothing + @test pix_read_bmp(filename) === nothing + @test pix_read_bmp("xyzzy.bmp") === nothing rm(filename) # ----------------------------------------------------------------------------------------- # From an IOBuffer. local buffer = IOBuffer() - @test pix_read_bmp(buffer) == nothing + @test pix_read_bmp(buffer) === nothing # ----------------------------------------------------------------------------------------- # To/From a byte array. local bytes = Vector{UInt8}() - @test pix_read_bmp(bytes) == nothing + @test pix_read_bmp(bytes) === nothing end end @@ -106,5 +106,5 @@ end # --------------------------------------------------------------------------------------------- # To a byte array. - @test (@test_logs (:error, err) pix_write_bmp(pix)) == nothing + @test (@test_logs (:error, err) pix_write_bmp(pix)) === nothing end diff --git a/test/leptonica/pix/common.jl b/test/leptonica/pix/common.jl index 373c811..93c3386 100644 --- a/test/leptonica/pix/common.jl +++ b/test/leptonica/pix/common.jl @@ -45,5 +45,5 @@ end pix_delete!(pix) - @test (@test_logs (:error, err) pix_get_dimensions(pix)) == nothing + @test (@test_logs (:error, err) pix_get_dimensions(pix)) === nothing end diff --git a/test/leptonica/pix/gif.jl b/test/leptonica/pix/gif.jl index 84a9377..c0433fd 100644 --- a/test/leptonica/pix/gif.jl +++ b/test/leptonica/pix/gif.jl @@ -30,7 +30,7 @@ # To/From a file. local filename = safe_tmp_file() @test pix_write_gif(filename, pix) == true - @test pix_read_gif(filename) != nothing + @test pix_read_gif(filename) !== nothing rm(filename) # --------------------------------------------------------------------------------------------- @@ -39,7 +39,7 @@ @test pix_write_gif(buffer, pix) == true @test position(buffer) != 0 seekstart(buffer) - @test pix_read_gif(buffer) != nothing + @test pix_read_gif(buffer) !== nothing # --------------------------------------------------------------------------------------------- # To/From an IOStream @@ -48,7 +48,7 @@ @test pix_write_gif(file, pix) == true @test position(file) != 0 seekstart(file) - @test pix_read_gif(file) != nothing + @test pix_read_gif(file) !== nothing close(file) rm(filename) @@ -56,7 +56,7 @@ # To/From a byte array. local bytes = pix_write_gif(pix) @test length(bytes) > 0 - @test pix_read_gif(bytes) != nothing + @test pix_read_gif(bytes) !== nothing end # ================================================================================================= @@ -66,19 +66,19 @@ end # ----------------------------------------------------------------------------------------- # From a file. local filename = safe_tmp_file() - @test pix_read_gif(filename) == nothing - @test pix_read_gif("xyzzy.gif") == nothing + @test pix_read_gif(filename) === nothing + @test pix_read_gif("xyzzy.gif") === nothing rm(filename) # ----------------------------------------------------------------------------------------- # From an IOBuffer. local buffer = IOBuffer() - @test pix_read_gif(buffer) == nothing + @test pix_read_gif(buffer) === nothing # ----------------------------------------------------------------------------------------- # To/From a byte array. local bytes = Vector{UInt8}() - @test pix_read_gif(bytes) == nothing + @test pix_read_gif(bytes) === nothing end end @@ -102,5 +102,5 @@ end # --------------------------------------------------------------------------------------------- # To a byte array. - @test (@test_logs (:error, err) pix_write_gif(pix)) == nothing + @test (@test_logs (:error, err) pix_write_gif(pix)) === nothing end diff --git a/test/leptonica/pix/jp2k.jl b/test/leptonica/pix/jp2k.jl index 9198b8d..5270969 100644 --- a/test/leptonica/pix/jp2k.jl +++ b/test/leptonica/pix/jp2k.jl @@ -31,7 +31,7 @@ # To/From a file. local filename = safe_tmp_file() @test pix_write_jp2k(filename, pix) == true - @test pix_read_jp2k(filename) != nothing + @test pix_read_jp2k(filename) !== nothing rm(filename) # ----------------------------------------------------------------------------------------- @@ -40,7 +40,7 @@ @test pix_write_jp2k(buffer, pix) == true @test position(buffer) != 0 seekstart(buffer) - @test pix_read_jp2k(buffer) != nothing + @test pix_read_jp2k(buffer) !== nothing # ----------------------------------------------------------------------------------------- # To/From an IOStream @@ -49,7 +49,7 @@ @test pix_write_jp2k(file, pix) == true @test position(file) != 0 seekstart(file) - @test pix_read_jp2k(file) != nothing + @test pix_read_jp2k(file) !== nothing close(file) rm(filename) @@ -58,7 +58,7 @@ local data = jp2k_with() local bytes = pix_write_jp2k(pix) @test length(bytes) > 0 - @test pix_read_jp2k(bytes) != nothing + @test pix_read_jp2k(bytes) !== nothing end end @@ -74,7 +74,7 @@ end local filename = safe_tmp_file() @test pix_write_jp2k(filename, pix; quality = quality, levels = levels) == true for i in 1:levels - @test pix_read_jp2k(filename; reduction = 2^(i-1)) != nothing + @test pix_read_jp2k(filename; reduction = 2^(i-1)) !== nothing end rm(filename) @@ -85,7 +85,7 @@ end @test position(buffer) != 0 for i in 1:levels seekstart(buffer) - @test pix_read_jp2k(buffer; reduction = 2^(i-1)) != nothing + @test pix_read_jp2k(buffer; reduction = 2^(i-1)) !== nothing end # ----------------------------------------------------------------------------------------- @@ -94,7 +94,7 @@ end local bytes = pix_write_jp2k(pix; quality = quality, levels = levels) @test length(bytes) > 0 for i in 1:levels - @test pix_read_jp2k(bytes; reduction = 2^(i-1)) != nothing + @test pix_read_jp2k(bytes; reduction = 2^(i-1)) !== nothing end end end @@ -115,7 +115,7 @@ end # To/From a file. local filename = safe_tmp_file() @test pix_write_jp2k(filename, pix) == true - @test pix_read_jp2k(filename; box = box, reduction=2^(level-1)) != nothing + @test pix_read_jp2k(filename; box = box, reduction=2^(level-1)) !== nothing rm(filename) # ----------------------------------------------------------------------------------------- @@ -124,14 +124,14 @@ end @test pix_write_jp2k(buffer, pix) == true @test position(buffer) != 0 seekstart(buffer) - @test pix_read_jp2k(buffer; box = box, reduction=2^(level-1)) != nothing + @test pix_read_jp2k(buffer; box = box, reduction=2^(level-1)) !== nothing # ----------------------------------------------------------------------------------------- # To/From a byte array. local data = jp2k_with() local bytes = pix_write_jp2k(pix) @test length(bytes) > 0 - @test pix_read_jp2k(bytes; box = box, reduction=2^(level-1)) != nothing + @test pix_read_jp2k(bytes; box = box, reduction=2^(level-1)) !== nothing end end @@ -143,19 +143,19 @@ end # ----------------------------------------------------------------------------------------- # From a file. local filename = safe_tmp_file() - @test pix_read_jp2k(filename) == nothing - @test pix_read_jp2k("xyzzy.j2k") == nothing + @test pix_read_jp2k(filename) === nothing + @test pix_read_jp2k("xyzzy.j2k") === nothing rm(filename) # ----------------------------------------------------------------------------------------- # From an IOBuffer. local buffer = IOBuffer() - @test pix_read_jp2k(buffer) == nothing + @test pix_read_jp2k(buffer) === nothing # ----------------------------------------------------------------------------------------- # To/From a byte array. local bytes = Vector{UInt8}() - @test pix_read_jp2k(bytes) == nothing + @test pix_read_jp2k(bytes) === nothing end end @@ -187,9 +187,9 @@ end @test length(take!(buffer)) == 0 # --------------------------------------------------------------------------------------------- # To a byte array. - @test (@test_logs (:error, err) pix_write_jp2k(pix; quality = -1)) == nothing - @test (@test_logs (:error, err) pix_write_jp2k(pix; quality = 0)) == nothing - @test (@test_logs (:error, err) pix_write_jp2k(pix; quality = 101)) == nothing + @test (@test_logs (:error, err) pix_write_jp2k(pix; quality = -1)) === nothing + @test (@test_logs (:error, err) pix_write_jp2k(pix; quality = 0)) === nothing + @test (@test_logs (:error, err) pix_write_jp2k(pix; quality = 101)) === nothing end # ================================================================================================= @@ -220,9 +220,9 @@ end @test length(take!(buffer)) == 0 # --------------------------------------------------------------------------------------------- # To a byte array. - @test (@test_logs (:error, err) pix_write_jp2k(pix; levels = -1)) == nothing - @test (@test_logs (:error, err) pix_write_jp2k(pix; levels = 0)) == nothing - @test (@test_logs (:error, err) pix_write_jp2k(pix; levels = 11)) == nothing + @test (@test_logs (:error, err) pix_write_jp2k(pix; levels = -1)) === nothing + @test (@test_logs (:error, err) pix_write_jp2k(pix; levels = 0)) === nothing + @test (@test_logs (:error, err) pix_write_jp2k(pix; levels = 11)) === nothing end # ================================================================================================= @@ -235,9 +235,9 @@ end # To/From a file. local filename = safe_tmp_file() @test pix_write_jp2k(filename, pix) == true - @test (@test_logs (:error, err) pix_read_jp2k(filename; reduction = -1)) == nothing - @test (@test_logs (:error, err) pix_read_jp2k(filename; reduction = 0)) == nothing - @test (@test_logs (:error, err) pix_read_jp2k(filename; reduction = 13)) == nothing + @test (@test_logs (:error, err) pix_read_jp2k(filename; reduction = -1)) === nothing + @test (@test_logs (:error, err) pix_read_jp2k(filename; reduction = 0)) === nothing + @test (@test_logs (:error, err) pix_read_jp2k(filename; reduction = 13)) === nothing rm(filename) # --------------------------------------------------------------------------------------------- @@ -246,19 +246,19 @@ end @test pix_write_jp2k(buffer, pix) == true @test position(buffer) != 0 seekstart(buffer) - @test (@test_logs (:error, err) pix_read_jp2k(buffer; reduction = -1)) == nothing + @test (@test_logs (:error, err) pix_read_jp2k(buffer; reduction = -1)) === nothing seekstart(buffer) - @test (@test_logs (:error, err) pix_read_jp2k(buffer; reduction = 0)) == nothing + @test (@test_logs (:error, err) pix_read_jp2k(buffer; reduction = 0)) === nothing seekstart(buffer) - @test (@test_logs (:error, err) pix_read_jp2k(buffer; reduction = 9)) == nothing + @test (@test_logs (:error, err) pix_read_jp2k(buffer; reduction = 9)) === nothing # --------------------------------------------------------------------------------------------- # To/From a byte array. local bytes = pix_write_jp2k(pix) @test length(bytes) > 0 - @test (@test_logs (:error, err) pix_read_jp2k(bytes; reduction = -1)) == nothing - @test (@test_logs (:error, err) pix_read_jp2k(bytes; reduction = 0)) == nothing - @test (@test_logs (:error, err) pix_read_jp2k(bytes; reduction = 6)) == nothing + @test (@test_logs (:error, err) pix_read_jp2k(bytes; reduction = -1)) === nothing + @test (@test_logs (:error, err) pix_read_jp2k(bytes; reduction = 0)) === nothing + @test (@test_logs (:error, err) pix_read_jp2k(bytes; reduction = 6)) === nothing end # ================================================================================================= @@ -281,5 +281,5 @@ end # --------------------------------------------------------------------------------------------- # To a byte array. - @test (@test_logs (:error, err) pix_write_jp2k(pix)) == nothing + @test (@test_logs (:error, err) pix_write_jp2k(pix)) === nothing end diff --git a/test/leptonica/pix/jpeg.jl b/test/leptonica/pix/jpeg.jl index 3dbe651..8566159 100644 --- a/test/leptonica/pix/jpeg.jl +++ b/test/leptonica/pix/jpeg.jl @@ -30,7 +30,7 @@ # To/From a file. local filename = safe_tmp_file() @test pix_write_jpeg(filename, pix) == true - @test pix_read_jpeg(filename) != nothing + @test pix_read_jpeg(filename) !== nothing rm(filename) # --------------------------------------------------------------------------------------------- @@ -39,7 +39,7 @@ @test pix_write_jpeg(buffer, pix) == true @test position(buffer) != 0 seekstart(buffer) - @test pix_read_jpeg(buffer) != nothing + @test pix_read_jpeg(buffer) !== nothing # --------------------------------------------------------------------------------------------- # To/From an IOStream @@ -48,7 +48,7 @@ @test pix_write_jpeg(file, pix) == true @test position(file) != 0 seekstart(file) - @test pix_read_jpeg(file) != nothing + @test pix_read_jpeg(file) !== nothing close(file) rm(filename) @@ -57,7 +57,7 @@ local data = jpeg_with() local bytes = pix_write_jpeg(pix) @test length(bytes) > 0 - @test pix_read_jpeg(bytes) != nothing + @test pix_read_jpeg(bytes) !== nothing end # ================================================================================================= @@ -71,7 +71,7 @@ end # To/From a file. local filename = safe_tmp_file() @test pix_write_jpeg(filename, pix; quality = quality, progressive = progressive) == true - @test pix_read_jpeg(filename) != nothing + @test pix_read_jpeg(filename) !== nothing rm(filename) # --------------------------------------------------------------------------------------------- @@ -80,14 +80,14 @@ end @test pix_write_jpeg(buffer, pix; quality = quality, progressive = progressive) == true @test position(buffer) != 0 seekstart(buffer) - @test pix_read_jpeg(buffer) != nothing + @test pix_read_jpeg(buffer) !== nothing # --------------------------------------------------------------------------------------------- # To/From a byte array. local data = jpeg_with() local bytes = pix_write_jpeg(pix; quality = quality, progressive = progressive) @test length(bytes) > 0 - @test pix_read_jpeg(bytes) != nothing + @test pix_read_jpeg(bytes) !== nothing end # ================================================================================================= @@ -101,7 +101,7 @@ end # To/From a file. local filename = safe_tmp_file() @test pix_write_jpeg(filename, pix) == true - @test pix_read_jpeg(filename; cmap = cmap, reduction = reduction, luminance = luminance) != nothing + @test pix_read_jpeg(filename; cmap = cmap, reduction = reduction, luminance = luminance) !== nothing rm(filename) # ----------------------------------------------------------------------------------------- @@ -110,14 +110,14 @@ end @test pix_write_jpeg(buffer, pix) == true @test position(buffer) != 0 seekstart(buffer) - @test pix_read_jpeg(buffer; cmap = cmap, reduction = reduction, luminance = luminance) != nothing + @test pix_read_jpeg(buffer; cmap = cmap, reduction = reduction, luminance = luminance) !== nothing # ----------------------------------------------------------------------------------------- # To/From a byte array. local data = jpeg_with() local bytes = pix_write_jpeg(pix) @test length(bytes) > 0 - @test pix_read_jpeg(bytes; cmap = cmap, reduction = reduction, luminance = luminance) != nothing + @test pix_read_jpeg(bytes; cmap = cmap, reduction = reduction, luminance = luminance) !== nothing end end @@ -128,19 +128,19 @@ end # ----------------------------------------------------------------------------------------- # From a file. local filename = safe_tmp_file() - @test pix_read_jpeg(filename) == nothing - @test pix_read_jpeg("xyzzy.jpg") == nothing + @test pix_read_jpeg(filename) === nothing + @test pix_read_jpeg("xyzzy.jpg") === nothing rm(filename) # ----------------------------------------------------------------------------------------- # From an IOBuffer. local buffer = IOBuffer() - @test pix_read_jpeg(buffer) == nothing + @test pix_read_jpeg(buffer) === nothing # ----------------------------------------------------------------------------------------- # To/From a byte array. local bytes = Vector{UInt8}() - @test pix_read_jpeg(bytes) == nothing + @test pix_read_jpeg(bytes) === nothing end end @@ -172,9 +172,9 @@ end @test length(take!(buffer)) == 0 # --------------------------------------------------------------------------------------------- # To a byte array. - @test (@test_logs (:error, err) pix_write_jpeg(pix; quality = 0)) == nothing - @test (@test_logs (:error, err) pix_write_jpeg(pix; quality = -1)) == nothing - @test (@test_logs (:error, err) pix_write_jpeg(pix; quality = 200)) == nothing + @test (@test_logs (:error, err) pix_write_jpeg(pix; quality = 0)) === nothing + @test (@test_logs (:error, err) pix_write_jpeg(pix; quality = -1)) === nothing + @test (@test_logs (:error, err) pix_write_jpeg(pix; quality = 200)) === nothing end # ================================================================================================= @@ -187,9 +187,9 @@ end # To/From a file. local filename = safe_tmp_file() @test pix_write_jpeg(filename, pix) == true - @test (@test_logs (:error, err) pix_read_jpeg(filename; reduction = 0)) == nothing - @test (@test_logs (:error, err) pix_read_jpeg(filename; reduction = 7)) == nothing - @test (@test_logs (:error, err) pix_read_jpeg(filename; reduction = 16)) == nothing + @test (@test_logs (:error, err) pix_read_jpeg(filename; reduction = 0)) === nothing + @test (@test_logs (:error, err) pix_read_jpeg(filename; reduction = 7)) === nothing + @test (@test_logs (:error, err) pix_read_jpeg(filename; reduction = 16)) === nothing rm(filename) # --------------------------------------------------------------------------------------------- @@ -198,19 +198,19 @@ end @test pix_write_jpeg(buffer, pix) == true @test position(buffer) != 0 seekstart(buffer) - @test (@test_logs (:error, err) pix_read_jpeg(buffer; reduction = 0)) == nothing + @test (@test_logs (:error, err) pix_read_jpeg(buffer; reduction = 0)) === nothing seekstart(buffer) - @test (@test_logs (:error, err) pix_read_jpeg(buffer; reduction = 7)) == nothing + @test (@test_logs (:error, err) pix_read_jpeg(buffer; reduction = 7)) === nothing seekstart(buffer) - @test (@test_logs (:error, err) pix_read_jpeg(buffer; reduction = 16)) == nothing + @test (@test_logs (:error, err) pix_read_jpeg(buffer; reduction = 16)) === nothing # --------------------------------------------------------------------------------------------- # To/From a byte array. local bytes = pix_write_jpeg(pix) @test length(bytes) > 0 - @test (@test_logs (:error, err) pix_read_jpeg(bytes; reduction = 0)) == nothing - @test (@test_logs (:error, err) pix_read_jpeg(bytes; reduction = 7)) == nothing - @test (@test_logs (:error, err) pix_read_jpeg(bytes; reduction = 16)) == nothing + @test (@test_logs (:error, err) pix_read_jpeg(bytes; reduction = 0)) === nothing + @test (@test_logs (:error, err) pix_read_jpeg(bytes; reduction = 7)) === nothing + @test (@test_logs (:error, err) pix_read_jpeg(bytes; reduction = 16)) === nothing end # ================================================================================================= @@ -233,5 +233,5 @@ end # --------------------------------------------------------------------------------------------- # To a byte array. - @test (@test_logs (:error, err) pix_write_jpeg(pix)) == nothing + @test (@test_logs (:error, err) pix_write_jpeg(pix)) === nothing end diff --git a/test/leptonica/pix/pam.jl b/test/leptonica/pix/pam.jl index 17e4762..253ac32 100644 --- a/test/leptonica/pix/pam.jl +++ b/test/leptonica/pix/pam.jl @@ -72,5 +72,5 @@ end # --------------------------------------------------------------------------------------------- # To a byte array. - @test (@test_logs (:error, err) pix_write_pam(pix)) == nothing + @test (@test_logs (:error, err) pix_write_pam(pix)) === nothing end diff --git a/test/leptonica/pix/pdf.jl b/test/leptonica/pix/pdf.jl index db7a5aa..16cb13c 100644 --- a/test/leptonica/pix/pdf.jl +++ b/test/leptonica/pix/pdf.jl @@ -112,10 +112,10 @@ end # --------------------------------------------------------------------------------------------- # To a byte array. local bytes = Vector{UInt8}() - @test (@test_logs (:error, err) pix_write_pdf(pix; ppi = 0)) == nothing - @test (@test_logs (:error, err) pix_write_pdf(pix; ppi = -300)) == nothing - @test (@test_logs (:error, err) pix_write_pdf(pix; ppi = 0, title = "Testing the test")) == nothing - @test (@test_logs (:error, err) pix_write_pdf(pix; ppi = -300, title = "Testing the test")) == nothing + @test (@test_logs (:error, err) pix_write_pdf(pix; ppi = 0)) === nothing + @test (@test_logs (:error, err) pix_write_pdf(pix; ppi = -300)) === nothing + @test (@test_logs (:error, err) pix_write_pdf(pix; ppi = 0, title = "Testing the test")) === nothing + @test (@test_logs (:error, err) pix_write_pdf(pix; ppi = -300, title = "Testing the test")) === nothing @test length(bytes) == 0 end @@ -139,5 +139,5 @@ end # --------------------------------------------------------------------------------------------- # To a byte array. - @test (@test_logs (:error, err) pix_write_pdf(pix)) == nothing + @test (@test_logs (:error, err) pix_write_pdf(pix)) === nothing end diff --git a/test/leptonica/pix/png.jl b/test/leptonica/pix/png.jl index 89b0dbe..8d3498c 100644 --- a/test/leptonica/pix/png.jl +++ b/test/leptonica/pix/png.jl @@ -27,7 +27,7 @@ local original = pix_write_pam(pix) function unchanged(test) - test != nothing && pix_write_pam(test) == original + test !== nothing && pix_write_pam(test) == original end # --------------------------------------------------------------------------------------------- @@ -71,27 +71,27 @@ end # ----------------------------------------------------------------------------------------- # From a file. local filename = safe_tmp_file() - @test pix_read_png(filename) == nothing - @test pix_read_png("xyzzy.png") == nothing + @test pix_read_png(filename) === nothing + @test pix_read_png("xyzzy.png") === nothing rm(filename) # ----------------------------------------------------------------------------------------- # From an IOBuffer. local buffer = IOBuffer() - @test pix_read_png(buffer) == nothing + @test pix_read_png(buffer) === nothing # ----------------------------------------------------------------------------------------- # From an IOStream local filename = safe_tmp_file() local file = open(filename, read=true, write=true) - @test pix_read_png(file) == nothing + @test pix_read_png(file) === nothing close(file) rm(filename) # ----------------------------------------------------------------------------------------- # To/From a byte array. local bytes = Vector{UInt8}() - @test pix_read_png(bytes) == nothing + @test pix_read_png(bytes) === nothing end end @@ -104,7 +104,7 @@ end # To/From a file. local filename = safe_tmp_file() @test pix_write_png(filename, pix; gamma = gamma) == true - @test pix_read_png(filename) != nothing + @test pix_read_png(filename) !== nothing rm(filename) # --------------------------------------------------------------------------------------------- @@ -113,7 +113,7 @@ end @test pix_write_png(buffer, pix; gamma = gamma) == true @test position(buffer) != 0 seekstart(buffer) - @test pix_read_png(buffer) != nothing + @test pix_read_png(buffer) !== nothing # --------------------------------------------------------------------------------------------- # To/From an IOStream @@ -122,7 +122,7 @@ end @test pix_write_png(file, pix; gamma = gamma) == true @test position(file) != 0 seekstart(file) - @test pix_read_png(file) != nothing + @test pix_read_png(file) !== nothing close(file) rm(filename) @@ -130,7 +130,7 @@ end # To/From a byte array. local bytes = pix_write_png(pix; gamma = gamma) @test length(bytes) > 0 - @test pix_read_png(bytes) != nothing + @test pix_read_png(bytes) !== nothing end # ================================================================================================= @@ -153,7 +153,7 @@ end # --------------------------------------------------------------------------------------------- # To/From a byte array. - @test (@test_logs (:error, err) pix_write_png(pix; gamma = gamma)) == nothing + @test (@test_logs (:error, err) pix_write_png(pix; gamma = gamma)) === nothing end # ================================================================================================= @@ -176,5 +176,5 @@ end # --------------------------------------------------------------------------------------------- # To a byte array. - @test (@test_logs (:error, err) pix_write_png(pix)) == nothing + @test (@test_logs (:error, err) pix_write_png(pix)) === nothing end diff --git a/test/leptonica/pix/pnm.jl b/test/leptonica/pix/pnm.jl index 74331ef..b9c873d 100644 --- a/test/leptonica/pix/pnm.jl +++ b/test/leptonica/pix/pnm.jl @@ -29,7 +29,7 @@ # To/From a file. local filename = safe_tmp_file() @test pix_write_pnm(filename, pix) == true - @test pix_read_pnm(filename) != nothing + @test pix_read_pnm(filename) !== nothing rm(filename) # --------------------------------------------------------------------------------------------- @@ -38,7 +38,7 @@ @test pix_write_pnm(buffer, pix) == true @test position(buffer) != 0 seekstart(buffer) - @test pix_read_pnm(buffer) != nothing + @test pix_read_pnm(buffer) !== nothing # --------------------------------------------------------------------------------------------- # To/From an IOStream @@ -47,7 +47,7 @@ @test pix_write_pnm(file, pix) == true @test position(file) != 0 seekstart(file) - @test pix_read_pnm(file) != nothing + @test pix_read_pnm(file) !== nothing close(file) rm(filename) @@ -55,7 +55,7 @@ # To/From a byte array. local bytes = pix_write_pnm(pix) @test length(bytes) > 0 - @test pix_read_pnm(bytes) != nothing + @test pix_read_pnm(bytes) !== nothing end # ================================================================================================= @@ -78,5 +78,5 @@ end # --------------------------------------------------------------------------------------------- # To a byte array. - @test (@test_logs (:error, err) pix_write_pnm(pix)) == nothing + @test (@test_logs (:error, err) pix_write_pnm(pix)) === nothing end diff --git a/test/leptonica/pix/ps.jl b/test/leptonica/pix/ps.jl index 71dbc73..0ca3a83 100644 --- a/test/leptonica/pix/ps.jl +++ b/test/leptonica/pix/ps.jl @@ -113,10 +113,10 @@ end # --------------------------------------------------------------------------------------------- # To a byte array. - @test (@test_logs (:error, errPpi) pix_write_ps(pix; ppi = -300)) == nothing - @test (@test_logs (:error, errScale) pix_write_ps(pix; scale = -1.0)) == nothing - @test (@test_logs (:error, errPpi) pix_write_ps(pix; box=box, ppi = -300)) == nothing - @test (@test_logs (:error, errScale) pix_write_ps(pix; box=box, scale = -1.0)) == nothing + @test (@test_logs (:error, errPpi) pix_write_ps(pix; ppi = -300)) === nothing + @test (@test_logs (:error, errScale) pix_write_ps(pix; scale = -1.0)) === nothing + @test (@test_logs (:error, errPpi) pix_write_ps(pix; box=box, ppi = -300)) === nothing + @test (@test_logs (:error, errScale) pix_write_ps(pix; box=box, scale = -1.0)) === nothing end # ================================================================================================= @@ -139,5 +139,5 @@ end # --------------------------------------------------------------------------------------------- # To a byte array. - @test (@test_logs (:error, err) pix_write_ps(pix)) == nothing + @test (@test_logs (:error, err) pix_write_ps(pix)) === nothing end diff --git a/test/leptonica/pix/read.jl b/test/leptonica/pix/read.jl index 6fa693a..98a389c 100644 --- a/test/leptonica/pix/read.jl +++ b/test/leptonica/pix/read.jl @@ -29,7 +29,7 @@ ] local filename = generator() - @test pix_read(filename) != nothing + @test pix_read(filename) !== nothing rm(filename) end @@ -39,10 +39,10 @@ end @testset "pix_read(filename) | type = jpeg /w parameters" begin local filename = jpeg_file_with() - @test pix_read(filename) != nothing - @suppress @test pix_read(filename; jpgLuminance = true) != nothing - @test pix_read(filename; jpgFailOnBadData = true) != nothing - @suppress @test pix_read(filename; jpgLuminance = true, jpgFailOnBadData = true) != nothing + @test pix_read(filename) !== nothing + @suppress @test pix_read(filename; jpgLuminance = true) !== nothing + @test pix_read(filename; jpgFailOnBadData = true) !== nothing + @suppress @test pix_read(filename; jpgLuminance = true, jpgFailOnBadData = true) !== nothing rm(filename) end @@ -53,14 +53,14 @@ end local filename = safe_tmp_file() @suppress begin - @test pix_read(filename) == nothing - @test pix_read("xyzzy.dat") == nothing - @test pix_read(filename; jpgFailOnBadData = true) == nothing - @test pix_read("xyzzy.dat"; jpgFailOnBadData = true) == nothing - @test pix_read(filename; jpgLuminance = true) == nothing - @test pix_read("xyzzy.dat"; jpgLuminance = true) == nothing - @test pix_read(filename; jpgLuminance = true, jpgFailOnBadData = true) == nothing - @test pix_read("xyzzy.dat"; jpgLuminance = true, jpgFailOnBadData = true) == nothing + @test pix_read(filename) === nothing + @test pix_read("xyzzy.dat") === nothing + @test pix_read(filename; jpgFailOnBadData = true) === nothing + @test pix_read("xyzzy.dat"; jpgFailOnBadData = true) === nothing + @test pix_read(filename; jpgLuminance = true) === nothing + @test pix_read("xyzzy.dat"; jpgLuminance = true) === nothing + @test pix_read(filename; jpgLuminance = true, jpgFailOnBadData = true) === nothing + @test pix_read("xyzzy.dat"; jpgLuminance = true, jpgFailOnBadData = true) === nothing end rm(filename) end @@ -74,14 +74,14 @@ end ] local data = generator() - @test pix_read(IOBuffer(data)) != nothing + @test pix_read(IOBuffer(data)) !== nothing local filename = safe_tmp_file() write(filename, data) local file = open(filename; read = true) - @test pix_read(file) != nothing + @test pix_read(file) !== nothing close(file) rm(filename) @@ -90,7 +90,7 @@ end # ================================================================================================= # Test reading with bad parameters. @testset "pix_read(IO) /w empty stream" begin - @test pix_read(IOBuffer()) == nothing + @test pix_read(IOBuffer()) === nothing end # ================================================================================================= @@ -101,11 +101,11 @@ end ("webp", webp_with) ] local data = generator() - @test pix_read(data) != nothing + @test pix_read(data) !== nothing end # ================================================================================================= # Test reading with bad parameters. @testset "pix_read(Vector{UInt8}) /w empty stream" begin - @test pix_read(Vector{UInt8}()) == nothing + @test pix_read(Vector{UInt8}()) === nothing end diff --git a/test/leptonica/pix/spix.jl b/test/leptonica/pix/spix.jl index b897fa0..408a9e9 100644 --- a/test/leptonica/pix/spix.jl +++ b/test/leptonica/pix/spix.jl @@ -29,7 +29,7 @@ # To/From a file. local filename = safe_tmp_file() @test pix_write_spix(filename, pix) == true - @test pix_read_spix(filename) != nothing + @test pix_read_spix(filename) !== nothing rm(filename) # --------------------------------------------------------------------------------------------- @@ -38,7 +38,7 @@ @test pix_write_spix(buffer, pix) == true @test position(buffer) != 0 seekstart(buffer) - @test pix_read_spix(buffer) != nothing + @test pix_read_spix(buffer) !== nothing # --------------------------------------------------------------------------------------------- # To/From an IOStream @@ -47,7 +47,7 @@ @test pix_write_spix(file, pix) == true @test position(file) != 0 seekstart(file) - @test pix_read_spix(file) != nothing + @test pix_read_spix(file) !== nothing close(file) rm(filename) @@ -56,7 +56,7 @@ local data = spix_with() local bytes = pix_write_spix(pix) @test length(bytes) > 0 - @test pix_read_spix(bytes) != nothing + @test pix_read_spix(bytes) !== nothing end # ================================================================================================= @@ -66,27 +66,27 @@ end # ----------------------------------------------------------------------------------------- # From a file. local filename = safe_tmp_file() - @test pix_read_spix(filename) == nothing - @test pix_read_spix("xyzzy.spix") == nothing + @test pix_read_spix(filename) === nothing + @test pix_read_spix("xyzzy.spix") === nothing rm(filename) # ----------------------------------------------------------------------------------------- # From an IOBuffer. local buffer = IOBuffer() - @test pix_read_spix(buffer) == nothing + @test pix_read_spix(buffer) === nothing # ----------------------------------------------------------------------------------------- # From an IOStream local filename = safe_tmp_file() local file = open(filename, read=true, write=true) - @test pix_read_spix(file) == nothing + @test pix_read_spix(file) === nothing close(file) rm(filename) # ----------------------------------------------------------------------------------------- # To/From a byte array. local bytes = Vector{UInt8}() - @test pix_read_spix(bytes) == nothing + @test pix_read_spix(bytes) === nothing end end @@ -110,5 +110,5 @@ end # --------------------------------------------------------------------------------------------- # To a byte array. - @test (@test_logs (:error, err) pix_write_spix(pix)) == nothing + @test (@test_logs (:error, err) pix_write_spix(pix)) === nothing end diff --git a/test/leptonica/pix/tiff.jl b/test/leptonica/pix/tiff.jl index afae727..a50aaa2 100644 --- a/test/leptonica/pix/tiff.jl +++ b/test/leptonica/pix/tiff.jl @@ -30,7 +30,7 @@ # To/From a file. local filename = safe_tmp_file() @test pix_write_tiff(filename, pix; compression = compression) == true - @test pix_read_tiff(filename) != nothing + @test pix_read_tiff(filename) !== nothing rm(filename) # --------------------------------------------------------------------------------------------- @@ -39,7 +39,7 @@ @test pix_write_tiff(buffer, pix; compression = compression) == true @test position(buffer) != 0 seekstart(buffer) - @test pix_read_tiff(buffer) != nothing + @test pix_read_tiff(buffer) !== nothing # --------------------------------------------------------------------------------------------- # To/From an IOStream @@ -48,7 +48,7 @@ @test pix_write_tiff(file, pix; compression = compression) == true @test position(file) != 0 seekstart(file) - @test pix_read_tiff(file) != nothing + @test pix_read_tiff(file) !== nothing close(file) rm(filename) @@ -57,7 +57,7 @@ local data = tiff_with() local bytes = pix_write_tiff(pix; compression = compression) @test length(bytes) > 0 - @test pix_read_tiff(bytes) != nothing + @test pix_read_tiff(bytes) !== nothing end # ================================================================================================= @@ -68,27 +68,27 @@ end # ----------------------------------------------------------------------------------------- # From a file. local filename = safe_tmp_file() - @test pix_read_tiff(filename) == nothing - @test pix_read_tiff("xyzzy.tiff") == nothing + @test pix_read_tiff(filename) === nothing + @test pix_read_tiff("xyzzy.tiff") === nothing rm(filename) # ----------------------------------------------------------------------------------------- # From an IOBuffer. local buffer = IOBuffer() - @test pix_read_tiff(buffer) == nothing + @test pix_read_tiff(buffer) === nothing # ----------------------------------------------------------------------------------------- # From an IOStream local filename = safe_tmp_file() local file = open(filename, read=true, write=true) - @test pix_read_tiff(file) == nothing + @test pix_read_tiff(file) === nothing close(file) rm(filename) # ----------------------------------------------------------------------------------------- # To/From a byte array. local bytes = Vector{UInt8}() - @test pix_read_tiff(bytes) == nothing + @test pix_read_tiff(bytes) === nothing end end @@ -129,7 +129,7 @@ end local data = tiff_with() @test ( @test_logs (:error, err) pix_write_tiff(pix; compression = compression) - ) == nothing + ) === nothing end # ================================================================================================= @@ -143,7 +143,7 @@ end ] function equal(pic, i) - pic != nothing && pix_write_pam(pic) == pix_write_pam(pixs[i]) + pic !== nothing && pix_write_pam(pic) == pix_write_pam(pixs[i]) end # --------------------------------------------------------------------------------------------- @@ -152,18 +152,18 @@ end @test pix_write_tiff(filename, pixs[1]; compression=compression, append=false) == true @test pix_write_tiff(filename, pixs[2]; compression=compression, append=true) == true @test pix_write_tiff(filename, pixs[3]; compression=compression, append=true) == true - @test pix_read_tiff(filename; page=0) == nothing + @test pix_read_tiff(filename; page=0) === nothing @test equal(pix_read_tiff(filename; page=1), 1) == true @test equal(pix_read_tiff(filename; page=2), 2) == true @test equal(pix_read_tiff(filename; page=3), 3) == true - @test pix_read_tiff(filename; page=4) == nothing + @test pix_read_tiff(filename; page=4) === nothing # --------------------------------------------------------------------------------------------- # From an IOBuffer. local buffer = IOBuffer(read(filename)) @test equal(pix_read_tiff(buffer), 1) == true seekstart(buffer) - @test pix_read_tiff(buffer; page=0) == nothing + @test pix_read_tiff(buffer; page=0) === nothing seekstart(buffer) @test equal(pix_read_tiff(buffer; page=1), 1) == true seekstart(buffer) @@ -171,14 +171,14 @@ end seekstart(buffer) @test equal(pix_read_tiff(buffer; page=3), 3) == true seekstart(buffer) - @test pix_read_tiff(buffer; page=4) == nothing + @test pix_read_tiff(buffer; page=4) === nothing # --------------------------------------------------------------------------------------------- # From an IOStream local file = open(filename, read=true, write=true) @test equal(pix_read_tiff(file), 1) == true seekstart(file) - @test pix_read_tiff(file; page=0) == nothing + @test pix_read_tiff(file; page=0) === nothing seekstart(file) @test equal(pix_read_tiff(file; page=1), 1) == true seekstart(file) @@ -186,18 +186,18 @@ end seekstart(file) @test equal(pix_read_tiff(file; page=3), 3) == true seekstart(file) - @test pix_read_tiff(file; page=4) == nothing + @test pix_read_tiff(file; page=4) === nothing close(file) # --------------------------------------------------------------------------------------------- # From a byte array. local data = read(filename) @test equal(pix_read_tiff(data), 1) == true - @test pix_read_tiff(filename; page=0) == nothing + @test pix_read_tiff(filename; page=0) === nothing @test equal(pix_read_tiff(data; page=1), 1) == true @test equal(pix_read_tiff(data; page=2), 2) == true @test equal(pix_read_tiff(data; page=3), 3) == true - @test pix_read_tiff(filename; page=4) == nothing + @test pix_read_tiff(filename; page=4) === nothing rm(filename) end @@ -217,52 +217,52 @@ end @test pix_write_tiff(filename, pixs[1]; compression=IFF_TIFF_JPEG, append=false) == true @test pix_write_tiff(filename, pixs[2]; compression=IFF_TIFF_JPEG, append=true) == true @test pix_write_tiff(filename, pixs[3]; compression=IFF_TIFF_JPEG, append=true) == true - @test pix_read_tiff(filename; page=0) == nothing - @test pix_read_tiff(filename; page=1) != nothing - @test pix_read_tiff(filename; page=2) != nothing - @test pix_read_tiff(filename; page=3) != nothing - @test pix_read_tiff(filename; page=4) == nothing + @test pix_read_tiff(filename; page=0) === nothing + @test pix_read_tiff(filename; page=1) !== nothing + @test pix_read_tiff(filename; page=2) !== nothing + @test pix_read_tiff(filename; page=3) !== nothing + @test pix_read_tiff(filename; page=4) === nothing # --------------------------------------------------------------------------------------------- # From an IOBuffer. local buffer = IOBuffer(read(filename)) - @test pix_read_tiff(buffer) != nothing + @test pix_read_tiff(buffer) !== nothing seekstart(buffer) - @test pix_read_tiff(buffer; page=0) == nothing + @test pix_read_tiff(buffer; page=0) === nothing seekstart(buffer) - @test pix_read_tiff(buffer; page=1) != nothing + @test pix_read_tiff(buffer; page=1) !== nothing seekstart(buffer) - @test pix_read_tiff(buffer; page=2) != nothing + @test pix_read_tiff(buffer; page=2) !== nothing seekstart(buffer) - @test pix_read_tiff(buffer; page=3) != nothing + @test pix_read_tiff(buffer; page=3) !== nothing seekstart(buffer) - @test pix_read_tiff(buffer; page=4) == nothing + @test pix_read_tiff(buffer; page=4) === nothing # --------------------------------------------------------------------------------------------- # From an IOStream local file = open(filename, read=true, write=true) - @test pix_read_tiff(file) != nothing + @test pix_read_tiff(file) !== nothing seekstart(file) - @test pix_read_tiff(file; page=0) == nothing + @test pix_read_tiff(file; page=0) === nothing seekstart(file) - @test pix_read_tiff(file; page=1) != nothing + @test pix_read_tiff(file; page=1) !== nothing seekstart(file) - @test pix_read_tiff(file; page=2) != nothing + @test pix_read_tiff(file; page=2) !== nothing seekstart(file) - @test pix_read_tiff(file; page=3) != nothing + @test pix_read_tiff(file; page=3) !== nothing seekstart(file) - @test pix_read_tiff(file; page=4) == nothing + @test pix_read_tiff(file; page=4) === nothing close(file) # --------------------------------------------------------------------------------------------- # From a byte array. local data = read(filename) - @test pix_read_tiff(data) != nothing - @test pix_read_tiff(data; page=0) == nothing - @test pix_read_tiff(data; page=1) != nothing - @test pix_read_tiff(data; page=2) != nothing - @test pix_read_tiff(data; page=3) != nothing - @test pix_read_tiff(data; page=4) == nothing + @test pix_read_tiff(data) !== nothing + @test pix_read_tiff(data; page=0) === nothing + @test pix_read_tiff(data; page=1) !== nothing + @test pix_read_tiff(data; page=2) !== nothing + @test pix_read_tiff(data; page=3) !== nothing + @test pix_read_tiff(data; page=4) === nothing rm(filename) end @@ -287,5 +287,5 @@ end # --------------------------------------------------------------------------------------------- # To a byte array. - @test (@test_logs (:error, err) pix_write_tiff(pix)) == nothing + @test (@test_logs (:error, err) pix_write_tiff(pix)) === nothing end diff --git a/test/leptonica/pix/webp.jl b/test/leptonica/pix/webp.jl index 71f3392..9b8290d 100644 --- a/test/leptonica/pix/webp.jl +++ b/test/leptonica/pix/webp.jl @@ -27,7 +27,7 @@ local original = pix_write_pam(pix) function unchanged(test) - test != nothing && pix_write_pam(test) == original + test !== nothing && pix_write_pam(test) == original end # --------------------------------------------------------------------------------------------- @@ -71,7 +71,7 @@ end local original = pix_write_pam(pix) function unchanged(test) - test != nothing && pix_write_pam(test) == original + test !== nothing && pix_write_pam(test) == original end # --------------------------------------------------------------------------------------------- @@ -93,7 +93,7 @@ end # To/From a byte array. local data = webp_with() local bytes = pix_write_webp(pix; quality = quality, lossless = true) - @test bytes != nothing + @test bytes !== nothing @test length(bytes) > 0 @test unchanged(pix_read_webp(bytes)) == true end @@ -107,7 +107,7 @@ end # To/From a file. local filename = safe_tmp_file() @test pix_write_webp(filename, pix; quality = quality, lossless = true) == true - @test pix_read_webp(filename) != nothing + @test pix_read_webp(filename) !== nothing rm(filename) # --------------------------------------------------------------------------------------------- @@ -116,15 +116,15 @@ end @test pix_write_webp(buffer, pix; quality = quality, lossless = true) == true @test position(buffer) != 0 seekstart(buffer) - @test pix_read_webp(buffer) != nothing + @test pix_read_webp(buffer) !== nothing # --------------------------------------------------------------------------------------------- # To/From a byte array. local data = webp_with() local bytes = pix_write_webp(pix; quality = quality, lossless = true) - @test bytes != nothing + @test bytes !== nothing @test length(bytes) > 0 - @test pix_read_webp(bytes) != nothing + @test pix_read_webp(bytes) !== nothing end # ================================================================================================= @@ -134,19 +134,19 @@ end # ----------------------------------------------------------------------------------------- # From a file. local filename = safe_tmp_file() - @test pix_read_webp(filename) == nothing - @test pix_read_webp("xyzzy.webp") == nothing + @test pix_read_webp(filename) === nothing + @test pix_read_webp("xyzzy.webp") === nothing rm(filename) # ----------------------------------------------------------------------------------------- # From an IOBuffer. local buffer = IOBuffer() - @test pix_read_webp(buffer) == nothing + @test pix_read_webp(buffer) === nothing # ----------------------------------------------------------------------------------------- # To/From a byte array. local bytes = Vector{UInt8}() - @test pix_read_webp(bytes) == nothing + @test pix_read_webp(bytes) === nothing end end @@ -175,8 +175,8 @@ end # --------------------------------------------------------------------------------------------- # To a byte array. - @test (@test_logs (:error, err) pix_write_webp(pix; lossless = false, quality = 0)) == nothing - @test (@test_logs (:error, err) pix_write_webp(pix; lossless = false, quality = 101)) == nothing + @test (@test_logs (:error, err) pix_write_webp(pix; lossless = false, quality = 0)) === nothing + @test (@test_logs (:error, err) pix_write_webp(pix; lossless = false, quality = 101)) === nothing end # ================================================================================================= @@ -199,5 +199,5 @@ end # --------------------------------------------------------------------------------------------- # To a byte array. - @test (@test_logs (:error, err) pix_write_webp(pix)) == nothing + @test (@test_logs (:error, err) pix_write_webp(pix)) === nothing end diff --git a/test/leptonica/pix/write.jl b/test/leptonica/pix/write.jl index 9eaa3a9..35d9328 100644 --- a/test/leptonica/pix/write.jl +++ b/test/leptonica/pix/write.jl @@ -27,7 +27,7 @@ local pix = pix_with() @test pix_write(filename, pix) == true - @test pix_read(filename) != nothing + @test pix_read(filename) !== nothing rm(filename) end @@ -87,7 +87,7 @@ end local err = "Pix has been freed." pix_delete!(pix) - @test (@test_logs (:error, err) pix_write(pix, format)) == nothing + @test (@test_logs (:error, err) pix_write(pix, format)) === nothing end # ================================================================================================= diff --git a/test/leptonica/pix_sanity.jl b/test/leptonica/pix_sanity.jl index 8c27e21..7432ebb 100644 --- a/test/leptonica/pix_sanity.jl +++ b/test/leptonica/pix_sanity.jl @@ -38,8 +38,8 @@ pix_write_spix(pix) ] - for i = 1:length(formats) - for j = 1:length(formats) + for i = eachindex(formats) + for j = eachindex(formats) if i != j @test formats[i] != formats[j] end diff --git a/test/tesseract/tess_inst_config.jl b/test/tesseract/tess_inst_config.jl index 3e61faf..2912e5e 100644 --- a/test/tesseract/tess_inst_config.jl +++ b/test/tesseract/tess_inst_config.jl @@ -55,7 +55,7 @@ end local err = "Instance has been freed." local inst = TessInst("eng", datadir) tess_delete!(inst) - @test (@test_logs (:error, err) tess_initialized_languages(inst)) == nothing + @test (@test_logs (:error, err) tess_initialized_languages(inst)) === nothing end # ------------------------------------------------------------------------------------------------- @@ -68,7 +68,7 @@ end local err = "Instance has been freed." local inst = TessInst("eng", datadir) tess_delete!(inst) - @test (@test_logs (:error, err) tess_loaded_languages(inst)) == nothing + @test (@test_logs (:error, err) tess_loaded_languages(inst)) === nothing end # ------------------------------------------------------------------------------------------------- @@ -81,7 +81,7 @@ end local err = "Instance has been freed." local inst = TessInst("eng", datadir) tess_delete!(inst) - @test (@test_logs (:error, err) tess_available_languages(inst)) == nothing + @test (@test_logs (:error, err) tess_available_languages(inst)) === nothing end # ------------------------------------------------------------------------------------------------- @@ -94,7 +94,7 @@ end local err = "Instance has been freed." local inst = TessInst("eng", datadir) tess_delete!(inst) - @test (@test_logs (:error, err) tess_params(inst)) == nothing + @test (@test_logs (:error, err) tess_params(inst)) === nothing end # ------------------------------------------------------------------------------------------------- diff --git a/test/tesseract/tess_inst_output.jl b/test/tesseract/tess_inst_output.jl index dd8b26f..7b56bfe 100644 --- a/test/tesseract/tess_inst_output.jl +++ b/test/tesseract/tess_inst_output.jl @@ -27,14 +27,14 @@ using Test local inst = TessInst("eng", datadir) local pix = pix_with() - @suppress @test tess_text(inst) == nothing + @suppress @test tess_text(inst) === nothing @test_nowarn tess_image(inst, pix) @test_nowarn tess_resolution(inst, 72) - @test tess_text(inst) != nothing + @test tess_text(inst) !== nothing local err = "Instance has been freed." tess_delete!(inst) - @test (@test_logs (:error, err) tess_text(inst)) == nothing + @test (@test_logs (:error, err) tess_text(inst)) === nothing end # ------------------------------------------------------------------------------------------------- @@ -43,14 +43,14 @@ end local inst = TessInst("eng", datadir) local pix = pix_with() - @suppress @test tess_hocr(inst) == nothing + @suppress @test tess_hocr(inst) === nothing @test_nowarn tess_image(inst, pix) @test_nowarn tess_resolution(inst, 72) - @test tess_hocr(inst) != nothing + @test tess_hocr(inst) !== nothing local err = "Instance has been freed." tess_delete!(inst) - @test (@test_logs (:error, err) tess_hocr(inst)) == nothing + @test (@test_logs (:error, err) tess_hocr(inst)) === nothing end # ------------------------------------------------------------------------------------------------- @@ -59,14 +59,14 @@ end local inst = TessInst("eng", datadir) local pix = pix_with() - @suppress @test tess_alto(inst) == nothing + @suppress @test tess_alto(inst) === nothing @test_nowarn tess_image(inst, pix) @test_nowarn tess_resolution(inst, 72) - @test tess_alto(inst) != nothing + @test tess_alto(inst) !== nothing local err = "Instance has been freed." tess_delete!(inst) - @test (@test_logs (:error, err) tess_alto(inst)) == nothing + @test (@test_logs (:error, err) tess_alto(inst)) === nothing end # ------------------------------------------------------------------------------------------------- @@ -75,14 +75,14 @@ end local inst = TessInst("eng", datadir) local pix = pix_with() - @suppress @test tess_tsv(inst) == nothing + @suppress @test tess_tsv(inst) === nothing @test_nowarn tess_image(inst, pix) @test_nowarn tess_resolution(inst, 72) - @test tess_tsv(inst) != nothing + @test tess_tsv(inst) !== nothing local err = "Instance has been freed." tess_delete!(inst) - @test (@test_logs (:error, err) tess_tsv(inst)) == nothing + @test (@test_logs (:error, err) tess_tsv(inst)) === nothing end # ------------------------------------------------------------------------------------------------- @@ -91,19 +91,19 @@ end local inst = TessInst("eng", datadir) local pix = pix_with() - @suppress @test tess_parsed_tsv(inst) == nothing + @suppress @test tess_parsed_tsv(inst) === nothing @test_nowarn tess_image(inst, pix) @test_nowarn tess_resolution(inst, 72) local result = tess_parsed_tsv(inst) - @test result != nothing + @test result !== nothing @test isempty(result) == false @suppress @test_nowarn show(result[1]) - local result = tess_parsed_tsv(inst, 2) == nothing + local result = tess_parsed_tsv(inst, 2) === nothing local err = "Instance has been freed." tess_delete!(inst) - @test (@test_logs (:error, err) tess_parsed_tsv(inst)) == nothing + @test (@test_logs (:error, err) tess_parsed_tsv(inst)) === nothing end # ------------------------------------------------------------------------------------------------- @@ -112,14 +112,14 @@ end local inst = TessInst("eng", datadir) local pix = pix_with() - @suppress @test tess_text_box(inst) == nothing + @suppress @test tess_text_box(inst) === nothing @test_nowarn tess_image(inst, pix) @test_nowarn tess_resolution(inst, 72) - @test tess_text_box(inst) != nothing + @test tess_text_box(inst) !== nothing local err = "Instance has been freed." tess_delete!(inst) - @test (@test_logs (:error, err) tess_text_box(inst)) == nothing + @test (@test_logs (:error, err) tess_text_box(inst)) === nothing end # ------------------------------------------------------------------------------------------------- @@ -128,14 +128,14 @@ end local inst = TessInst("eng", datadir) local pix = pix_with() - @suppress @test tess_word_box(inst) == nothing + @suppress @test tess_word_box(inst) === nothing @test_nowarn tess_image(inst, pix) @test_nowarn tess_resolution(inst, 72) - @test tess_word_box(inst) != nothing + @test tess_word_box(inst) !== nothing local err = "Instance has been freed." tess_delete!(inst) - @test (@test_logs (:error, err) tess_word_box(inst)) == nothing + @test (@test_logs (:error, err) tess_word_box(inst)) === nothing end # ------------------------------------------------------------------------------------------------- @@ -144,14 +144,14 @@ end local inst = TessInst("eng", datadir) local pix = pix_with() - @suppress @test tess_lstm_box(inst) == nothing + @suppress @test tess_lstm_box(inst) === nothing @test_nowarn tess_image(inst, pix) @test_nowarn tess_resolution(inst, 72) - @test tess_lstm_box(inst) != nothing + @test tess_lstm_box(inst) !== nothing local err = "Instance has been freed." tess_delete!(inst) - @test (@test_logs (:error, err) tess_lstm_box(inst)) == nothing + @test (@test_logs (:error, err) tess_lstm_box(inst)) === nothing end # ------------------------------------------------------------------------------------------------- @@ -160,14 +160,14 @@ end local inst = TessInst("eng", datadir) local pix = pix_with() - @suppress @test tess_unlv(inst) == nothing + @suppress @test tess_unlv(inst) === nothing @test_nowarn tess_image(inst, pix) @test_nowarn tess_resolution(inst, 72) - @test tess_unlv(inst) != nothing + @test tess_unlv(inst) !== nothing local err = "Instance has been freed." tess_delete!(inst) - @test (@test_logs (:error, err) tess_unlv(inst)) == nothing + @test (@test_logs (:error, err) tess_unlv(inst)) === nothing end # ------------------------------------------------------------------------------------------------- @@ -176,14 +176,14 @@ end local inst = TessInst("eng", datadir) local pix = pix_with() - @suppress @test tess_unlv_latin1(inst) == nothing + @suppress @test tess_unlv_latin1(inst) === nothing @test_nowarn tess_image(inst, pix) @test_nowarn tess_resolution(inst, 72) - @test tess_unlv_latin1(inst) != nothing + @test tess_unlv_latin1(inst) !== nothing local err = "Instance has been freed." tess_delete!(inst) - @test (@test_logs (:error, err) tess_unlv_latin1(inst)) == nothing + @test (@test_logs (:error, err) tess_unlv_latin1(inst)) === nothing end # ------------------------------------------------------------------------------------------------- @@ -192,15 +192,15 @@ end local inst = TessInst("eng", datadir) local pix = pix_with() - @suppress @test tess_confidences(inst) == nothing + @suppress @test tess_confidences(inst) === nothing @test_nowarn tess_image(inst, pix) @test_nowarn tess_resolution(inst, 72) @test tess_recognize(inst) == true - @test tess_confidences(inst) != nothing + @test tess_confidences(inst) !== nothing local err = "Instance has been freed." tess_delete!(inst) - @test (@test_logs (:error, err) tess_confidences(inst)) == nothing + @test (@test_logs (:error, err) tess_confidences(inst)) === nothing end # ------------------------------------------------------------------------------------------------- @@ -214,5 +214,5 @@ end local err = "Instance has been freed." tess_delete!(inst) - @test (@test_logs (:error, err) tess_resolution(inst, 72)) == nothing + @test (@test_logs (:error, err) tess_resolution(inst, 72)) === nothing end diff --git a/test/tesseract/tess_output.jl b/test/tesseract/tess_output.jl index bb68c7e..e687dbc 100644 --- a/test/tesseract/tess_output.jl +++ b/test/tesseract/tess_output.jl @@ -27,7 +27,7 @@ using Test local test = TessOutput(String) @test is_available(test) == false - @test test[] == nothing + @test test[] === nothing test.result = "abc" diff --git a/test/tesseract/tess_pipeline_alto.jl b/test/tesseract/tess_pipeline_alto.jl index 214178b..3765465 100644 --- a/test/tesseract/tess_pipeline_alto.jl +++ b/test/tesseract/tess_pipeline_alto.jl @@ -73,7 +73,7 @@ end end) == true @test is_available(output) == true - @test output[] != nothing + @test output[] !== nothing local lines = split(output[], "\n"; keepempty=false) @test length(lines) == 75 diff --git a/test/tesseract/tess_pipeline_hocr.jl b/test/tesseract/tess_pipeline_hocr.jl index f82232a..3941abe 100644 --- a/test/tesseract/tess_pipeline_hocr.jl +++ b/test/tesseract/tess_pipeline_hocr.jl @@ -76,7 +76,7 @@ end end) == true @test is_available(output) == true - @test output[] != nothing + @test output[] !== nothing local lines = split(output[], "\n"; keepempty=false) @test length(lines) == 62 diff --git a/test/tesseract/tess_pipeline_lstm_box.jl b/test/tesseract/tess_pipeline_lstm_box.jl index a7d1a95..0fb7aa8 100644 --- a/test/tesseract/tess_pipeline_lstm_box.jl +++ b/test/tesseract/tess_pipeline_lstm_box.jl @@ -73,7 +73,7 @@ end end) == true @test is_available(output) == true - @test output[] != nothing + @test output[] !== nothing local lines = split(output[], "\n"; keepempty=false) @test length(lines) == 81 diff --git a/test/tesseract/tess_pipeline_pdf.jl b/test/tesseract/tess_pipeline_pdf.jl index 3b7217a..6cb15f9 100644 --- a/test/tesseract/tess_pipeline_pdf.jl +++ b/test/tesseract/tess_pipeline_pdf.jl @@ -60,7 +60,7 @@ end end) == true @test is_available(output) == true - @test output[] != nothing + @test output[] !== nothing @test length(output[]) > 0 end diff --git a/test/tesseract/tess_pipeline_text.jl b/test/tesseract/tess_pipeline_text.jl index 13477d2..25af310 100644 --- a/test/tesseract/tess_pipeline_text.jl +++ b/test/tesseract/tess_pipeline_text.jl @@ -69,7 +69,7 @@ end end) == true @test is_available(output) == true - @test output[] != nothing + @test output[] !== nothing local lines = split(output[], r"[\n\f]"; keepempty=false) @test length(lines) == 4 diff --git a/test/tesseract/tess_pipeline_unlv.jl b/test/tesseract/tess_pipeline_unlv.jl index c78270b..272893d 100644 --- a/test/tesseract/tess_pipeline_unlv.jl +++ b/test/tesseract/tess_pipeline_unlv.jl @@ -100,7 +100,7 @@ end end) == true @test is_available(output) == true - @test output[] != nothing + @test output[] !== nothing local lines = split(output[], "\n"; keepempty=false) @test length(lines) == 4 @@ -157,7 +157,7 @@ end end) == true @test is_available(output) == true - @test output[] != nothing + @test output[] !== nothing local lines = split(String(output[]), "\n"; keepempty=false) @test length(lines) == 4 diff --git a/test/tesseract/tess_run_pipeline_callback.jl b/test/tesseract/tess_run_pipeline_callback.jl index 12c3023..c7e1afd 100644 --- a/test/tesseract/tess_run_pipeline_callback.jl +++ b/test/tesseract/tess_run_pipeline_callback.jl @@ -39,7 +39,7 @@ end local inst = TessInst("eng", datadir) local pipeline = TessPipeline(inst) - @test tess_pipeline_text(pipeline) != nothing + @test tess_pipeline_text(pipeline) !== nothing tess_delete!(inst) @@ -57,7 +57,7 @@ end local inst = TessInst("eng", datadir) local pipeline = TessPipeline(inst) - @test tess_pipeline_text(pipeline) != nothing + @test tess_pipeline_text(pipeline) !== nothing @suppress begin @test (tess_run_pipeline(pipeline) do add @@ -74,7 +74,7 @@ end local inst = TessInst("eng", datadir) local pipeline = TessPipeline(inst) - @test tess_pipeline_text(pipeline) != nothing + @test tess_pipeline_text(pipeline) !== nothing @suppress begin @test (tess_run_pipeline(pipeline) do add @@ -91,7 +91,7 @@ end local inst = TessInst("eng", datadir) local pipeline = TessPipeline(inst) - @test tess_pipeline_text(pipeline) != nothing + @test tess_pipeline_text(pipeline) !== nothing @test (tess_run_pipeline(pipeline) do add @test add(pix_with([Line("This is image one.")]), 72) == true diff --git a/test/tesseract/tess_run_pipeline_filename.jl b/test/tesseract/tess_run_pipeline_filename.jl index dd0e8ef..7f3cf92 100644 --- a/test/tesseract/tess_run_pipeline_filename.jl +++ b/test/tesseract/tess_run_pipeline_filename.jl @@ -99,7 +99,7 @@ end local pipeline = TessPipeline(inst) local err = "Instance has been freed." - @test tess_pipeline_text(pipeline) != nothing + @test tess_pipeline_text(pipeline) !== nothing local pix1, io = mktemp(;cleanup=false); close(io) local pix2, io = mktemp(;cleanup=false); close(io) From 04c2c5f18859b004c74812a0e55045c6323d4be6 Mon Sep 17 00:00:00 2001 From: Joshua Gentry Date: Wed, 26 Oct 2022 10:21:50 -0400 Subject: [PATCH 2/2] Dropped the version back to 0.4.0. --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index e71f691..8ec5bd1 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Tesseract" uuid = "11879493-52b3-4e20-990d-281c54a395a1" authors = ["Joshua Gentry "] -version = "0.4.1" +version = "0.4.0" [deps] Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"