Skip to content

Commit c80766e

Browse files
author
Christopher Doris
committed
fix tests
1 parent 4dec082 commit c80766e

File tree

7 files changed

+35
-31
lines changed

7 files changed

+35
-31
lines changed

src/Compat/Compat.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ using ..Wrap: PyArray, PyPandasDataFrame
2525
using Serialization: Serialization, AbstractSerializer, serialize, deserialize
2626
using Tables: Tables
2727
using Requires: @require
28-
import ..PythonCall: pytable
28+
import ..PythonCall: pytable, event_loop_on, event_loop_off, fix_qt_plugin_path
2929

3030
include("gui.jl")
3131
include("ipython.jl")

src/Convert/Convert.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ using ..Core:
4747
pybool_asbool
4848
using Dates: Date, Time, DateTime, Second, Millisecond, Microsecond, Nanosecond
4949

50-
import PythonCall: pyconvert, @pyconvert
50+
import PythonCall:
51+
pyconvert, @pyconvert, pyconvert_add_rule, pyconvert_return, pyconvert_unconverted
5152

5253
include("pyconvert.jl")
5354
include("rules.jl")

src/JlWrap/objectarray.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ end
3131
@propagate_inbounds function Base.setindex!(x::PyObjectArray, v, i::Integer...)
3232
@boundscheck checkbounds(x, i...)
3333
v_ = Py(v)
34-
@inbounds decref(x.ptrs[i...])
34+
@inbounds decref(C.PyPtr(x.ptrs[i...]))
3535
@inbounds x.ptrs[i...] = incref(getptr(v_))
3636
return x
3737
end
3838

3939
@propagate_inbounds function Base.deleteat!(x::PyObjectVector, i::Integer)
4040
@boundscheck checkbounds(x, i)
41-
@inbounds decref(x.ptrs[i])
41+
@inbounds decref(C.PyPtr(x.ptrs[i]))
4242
deleteat!(x.ptrs, i)
4343
return x
4444
end

test/Compat.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ end
2121
pystdout = sys.stdout
2222
fp = sys.stdout = io.StringIO()
2323
try
24-
d = PythonCall.Compat.PythonDisplay()
24+
d = PythonCall.Internals.Compat.PythonDisplay()
2525
@test display(d, 123) === nothing
2626
fp.seek(0)
2727
@test pyconvert(String, fp.read()) == "123\n"

test/GC.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
end
88
Threads.nthreads() > 1 &&
99
VERSION >= v"1.10.0-" &&
10-
@test !isempty(PythonCall.GC.QUEUE.items)
11-
PythonCall.GC.gc()
12-
@test isempty(PythonCall.GC.QUEUE.items)
10+
@test !isempty(PythonCall.Internals.GC.QUEUE.items)
11+
PythonCall.Internals.GC.gc()
12+
@test isempty(PythonCall.Internals.GC.QUEUE.items)
1313
end
1414

1515
@testitem "GC.GCHook" begin
@@ -21,7 +21,7 @@ end
2121
end
2222
Threads.nthreads() > 1 &&
2323
VERSION >= v"1.10.0-" &&
24-
@test !isempty(PythonCall.GC.QUEUE.items)
24+
@test !isempty(PythonCall.Internals.GC.QUEUE.items)
2525
GC.gc()
26-
@test isempty(PythonCall.GC.QUEUE.items)
26+
@test isempty(PythonCall.Internals.GC.QUEUE.items)
2727
end

test/JlWrap.jl

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
Base.in(v::Int, x::Foo) = x.value == v
2626
Base.nameof(x::Foo) = "nameof $(x.value)"
2727
@testset "type" begin
28-
@test pyis(pytype(pyjl(Foo(1))), PythonCall.pyjlanytype)
29-
@test pyis(pytype(pyjl(nothing)), PythonCall.pyjlanytype)
30-
@test pyis(pytype(pyjl(missing)), PythonCall.pyjlanytype)
28+
@test pyis(pytype(pyjl(Foo(1))), PythonCall.Internals.JlWrap.pyjlanytype)
29+
@test pyis(pytype(pyjl(nothing)), PythonCall.Internals.JlWrap.pyjlanytype)
30+
@test pyis(pytype(pyjl(missing)), PythonCall.Internals.JlWrap.pyjlanytype)
3131
end
3232
@testset "bool" begin
3333
@test pytruth(pyjl(Foo(0)))
@@ -217,8 +217,8 @@ end
217217

218218
@testitem "array" begin
219219
@testset "type" begin
220-
@test pyis(pytype(pyjl(fill(nothing))), PythonCall.pyjlarraytype)
221-
@test pyis(pytype(pyjl([1 2; 3 4])), PythonCall.pyjlarraytype)
220+
@test pyis(pytype(pyjl(fill(nothing))), PythonCall.Internals.JlWrap.pyjlarraytype)
221+
@test pyis(pytype(pyjl([1 2; 3 4])), PythonCall.Internals.JlWrap.pyjlarraytype)
222222
end
223223
@testset "bool" begin
224224
@test !pytruth(pyjl(fill(nothing, 0, 1)))
@@ -305,7 +305,7 @@ end
305305
@testset "copy" begin
306306
x = pyjl([1 2; 3 4])
307307
y = x.copy()
308-
@test pyis(pytype(y), PythonCall.pyjlarraytype)
308+
@test pyis(pytype(y), PythonCall.Internals.JlWrap.pyjlarraytype)
309309
@test pyjlvalue(x) == pyjlvalue(y)
310310
@test typeof(pyjlvalue(x)) == typeof(pyjlvalue(y))
311311
@test pyjlvalue(x) !== pyjlvalue(y)
@@ -354,7 +354,7 @@ end
354354

355355
@testitem "dict" begin
356356
@testset "type" begin
357-
@test pyis(pytype(pyjl(Dict())), PythonCall.pyjldicttype)
357+
@test pyis(pytype(pyjl(Dict())), PythonCall.Internals.JlWrap.pyjldicttype)
358358
end
359359
@testset "bool" begin
360360
@test !pytruth(pyjl(Dict()))
@@ -364,9 +364,12 @@ end
364364

365365
@testitem "io" begin
366366
@testset "type" begin
367-
@test pyis(pytype(pyjl(devnull)), PythonCall.pyjlbinaryiotype)
368-
@test pyis(pytype(pybinaryio(devnull)), PythonCall.pyjlbinaryiotype)
369-
@test pyis(pytype(pytextio(devnull)), PythonCall.pyjltextiotype)
367+
@test pyis(pytype(pyjl(devnull)), PythonCall.Internals.JlWrap.pyjlbinaryiotype)
368+
@test pyis(
369+
pytype(pybinaryio(devnull)),
370+
PythonCall.Internals.JlWrap.pyjlbinaryiotype,
371+
)
372+
@test pyis(pytype(pytextio(devnull)), PythonCall.Internals.JlWrap.pyjltextiotype)
370373
end
371374
@testset "bool" begin
372375
@test pytruth(pybinaryio(devnull))
@@ -384,7 +387,7 @@ end
384387

385388
@testitem "module" begin
386389
@testset "type" begin
387-
@test pyis(pytype(pyjl(PythonCall)), PythonCall.pyjlmoduletype)
390+
@test pyis(pytype(pyjl(PythonCall)), PythonCall.Internals.JlWrap.pyjlmoduletype)
388391
end
389392
@testset "bool" begin
390393
@test pytruth(pyjl(PythonCall))
@@ -398,11 +401,11 @@ end
398401

399402
@testitem "number" begin
400403
@testset "type" begin
401-
@test pyis(pytype(pyjl(false)), PythonCall.pyjlintegertype)
402-
@test pyis(pytype(pyjl(0)), PythonCall.pyjlintegertype)
403-
@test pyis(pytype(pyjl(0 // 1)), PythonCall.pyjlrationaltype)
404-
@test pyis(pytype(pyjl(0.0)), PythonCall.pyjlrealtype)
405-
@test pyis(pytype(pyjl(Complex(0.0))), PythonCall.pyjlcomplextype)
404+
@test pyis(pytype(pyjl(false)), PythonCall.Internals.JlWrap.pyjlintegertype)
405+
@test pyis(pytype(pyjl(0)), PythonCall.Internals.JlWrap.pyjlintegertype)
406+
@test pyis(pytype(pyjl(0 // 1)), PythonCall.Internals.JlWrap.pyjlrationaltype)
407+
@test pyis(pytype(pyjl(0.0)), PythonCall.Internals.JlWrap.pyjlrealtype)
408+
@test pyis(pytype(pyjl(Complex(0.0))), PythonCall.Internals.JlWrap.pyjlcomplextype)
406409
end
407410
@testset "bool" begin
408411
@test !pytruth(pyjl(false))
@@ -428,7 +431,7 @@ end
428431

429432
@testitem "set" begin
430433
@testset "type" begin
431-
@test pyis(pytype(pyjl(Set())), PythonCall.pyjlsettype)
434+
@test pyis(pytype(pyjl(Set())), PythonCall.Internals.JlWrap.pyjlsettype)
432435
end
433436
@testset "bool" begin
434437
@test !pytruth(pyjl(Set()))
@@ -438,7 +441,7 @@ end
438441

439442
@testitem "type" begin
440443
@testset "type" begin
441-
@test pyis(pytype(pyjl(Int)), PythonCall.pyjltypetype)
444+
@test pyis(pytype(pyjl(Int)), PythonCall.Internals.JlWrap.pyjltypetype)
442445
end
443446
@testset "bool" begin
444447
@test pytruth(pyjl(Int))
@@ -447,7 +450,7 @@ end
447450

448451
@testitem "vector" begin
449452
@testset "type" begin
450-
@test pyis(pytype(pyjl([1, 2, 3, 4])), PythonCall.pyjlvectortype)
453+
@test pyis(pytype(pyjl([1, 2, 3, 4])), PythonCall.Internals.JlWrap.pyjlvectortype)
451454
end
452455
@testset "bool" begin
453456
@test !pytruth(pyjl([]))

test/Utils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Base.show(io::IO, ::MIME"text/x-test", x::Test) = show(io, x.t)
88

99
@testset for x in Any[1, "foo", [], 'z', Test(5)]
10-
mimes = PythonCall.Utils.mimes_for(x)
10+
mimes = PythonCall.Internals.Utils.mimes_for(x)
1111
@test mimes isa Vector{String}
1212
@test "text/plain" in mimes
1313
@test "text/html" in mimes
@@ -16,7 +16,7 @@
1616
end
1717

1818
@testitem "StaticString length and indexing" begin
19-
s = PythonCall.Utils.StaticString{UInt32,44}("ababababb")
19+
s = PythonCall.Internals.Utils.StaticString{UInt32,44}("ababababb")
2020
@test length(s) == 9
2121
@test s[1] == 'a'
2222
@test s[1:2] == "ab"

0 commit comments

Comments
 (0)