Skip to content

Commit 6db26b2

Browse files
committed
Next fix
1 parent bc7125c commit 6db26b2

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

test/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
1313
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1414
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
1515
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
16+
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
1617
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1718
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
1819
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
@@ -35,6 +36,7 @@ Documenter = "1.8"
3536
Interpolations = "0.15, 0.16"
3637
LinearAlgebra = "1"
3738
Logging = "1"
39+
PythonCall = "0.9"
3840
Random = "1.10.0"
3941
Serialization = "1"
4042
StaticArrays = "1"

test/plotting/test_plotting.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ end
1616
backend = if "plot-controlplots" in ARGS
1717
using ControlPlots
1818
import ControlPlots: plt
19+
using PythonCall: pyconvert
1920
"ControlPlots"
2021
else
2122
using CairoMakie
@@ -293,15 +294,19 @@ end
293294

294295
# CP-specific tests (DPI, matplotlib internals)
295296
if backend == "ControlPlots"
297+
# `get_dpi()` returns a Python float; convert to a Julia Float64 so the
298+
# comparisons below evaluate to a Julia `Bool` rather than a `Py` object.
299+
get_dpi(fig) = pyconvert(Float64, fig.get_dpi())
300+
296301
fig_dpi = plt.figure()
297-
default_dpi = fig_dpi.get_dpi()
302+
default_dpi = get_dpi(fig_dpi)
298303
@test default_dpi != 173
299304

300305
show_plot(fig_dpi; dpi=173)
301-
@test fig_dpi.get_dpi() == 173
306+
@test get_dpi(fig_dpi) == 173
302307

303308
show_plot(fig_dpi)
304-
@test fig_dpi.get_dpi() == 130
309+
@test get_dpi(fig_dpi) == 130
305310
plt.close(fig_dpi)
306311
end
307312

0 commit comments

Comments
 (0)