Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,10 @@ def test_matshow(fig_test, fig_ref):
ax_ref.xaxis.set_ticks_position('both')


@image_comparison([f'formatter_ticker_{i:03d}.png' for i in range(1, 6)], style='mpl20',
tol=0.03 if sys.platform == 'darwin' else 0)
@image_comparison([f'formatter_ticker_{i:03d}.png' for i in range(1, 6)],
style='mpl20',
tol=(0.03 if sys.platform == 'darwin'
or platform.machine() == 'loongarch64' else 0))
def test_formatter_ticker():
import matplotlib.testing.jpl_units as units
units.register()
Expand Down Expand Up @@ -5608,7 +5610,8 @@ def test_marker_styles():


@image_comparison(['rc_markerfill.png'], style='mpl20',
tol=0.033 if sys.platform == 'darwin' else 0)
tol=(0.033 if sys.platform == 'darwin'
or platform.machine() == 'loongarch64' else 0))
def test_markers_fillstyle_rcparams():
fig, ax = plt.subplots()
x = np.arange(7)
Expand All @@ -5630,8 +5633,10 @@ def test_vertex_markers():
ax.set_ylim(-1, 10)


@image_comparison(['vline_hline_zorder.png', 'errorbar_zorder.png'], style='mpl20',
tol=0.02 if sys.platform == 'darwin' else 0)
@image_comparison(['vline_hline_zorder.png', 'errorbar_zorder.png'],
style='mpl20',
tol=(0.02 if sys.platform == 'darwin'
or platform.machine() == 'loongarch64' else 0))
def test_eb_line_zorder():
x = list(range(10))

Expand Down Expand Up @@ -6681,7 +6686,8 @@ def test_pie_linewidth_0():


@image_comparison(['pie_center_radius.png'], style='mpl20',
tol=0.01 if sys.platform == 'darwin' else 0)
tol=(0.01 if sys.platform == 'darwin'
or platform.machine() == 'loongarch64' else 0))
def test_pie_center_radius():
# The slices will be ordered and plotted counter-clockwise.
labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
Expand Down Expand Up @@ -9901,7 +9907,8 @@ def test_zorder_and_explicit_rasterization():


@image_comparison(["preset_clip_paths.png"], remove_text=True, style="mpl20",
tol=0.01 if sys.platform == 'darwin' else 0)
tol=(0.01 if sys.platform == 'darwin'
or platform.machine() == 'loongarch64' else 0))
def test_preset_clip_paths():
fig, ax = plt.subplots()

Expand Down
3 changes: 2 additions & 1 deletion lib/matplotlib/tests/test_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,8 @@ def test_subfigure_dpi():

@image_comparison(['test_subfigure_ss.png'], style='mpl20',
savefig_kwarg={'facecolor': 'teal'},
tol=0.022 if sys.platform == 'darwin' else 0)
tol=(0.022 if sys.platform == 'darwin'
or platform.machine() == 'loongarch64' else 0))
def test_subfigure_ss():
# test assigning the subfigure via subplotspec
np.random.seed(19680801)
Expand Down
6 changes: 4 additions & 2 deletions lib/matplotlib/tests/test_inset.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ def test_inset_indicator_zorder():
assert inset.get_zorder() == 42


@image_comparison(['zoom_inset_connector_styles.png'], remove_text=True, style='mpl20',
tol=0.024 if platform.machine() in ['aarch64', 'arm64'] else 0)
@image_comparison(['zoom_inset_connector_styles.png'],
remove_text=True, style='mpl20',
tol=(0.024 if platform.machine() in ['aarch64', 'arm64',
'loongarch64'] else 0))
def test_zoom_inset_connector_styles():
fig, axs = plt.subplots(2)
for ax in axs:
Expand Down
6 changes: 4 additions & 2 deletions lib/matplotlib/tests/test_legend.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ def test_alpha_rcparam():


@image_comparison(['fancy.png'], remove_text=True, style='mpl20',
tol=0.01 if sys.platform == 'darwin' else 0)
tol=(0.01 if sys.platform == 'darwin'
or platform.machine() == 'loongarch64' else 0))
def test_fancy():
# using subplot triggers some offsetbox functionality untested elsewhere
plt.subplot(121)
Expand Down Expand Up @@ -665,7 +666,8 @@ def test_empty_bar_chart_with_legend():


@image_comparison(['shadow_argument_types.png'], remove_text=True, style='mpl20',
tol=0.028 if sys.platform == 'darwin' else 0)
tol=(0.028 if sys.platform == 'darwin'
or platform.machine() == 'loongarch64' else 0))
def test_shadow_argument_types():
# Test that different arguments for shadow work as expected
fig, ax = plt.subplots()
Expand Down
7 changes: 5 additions & 2 deletions lib/matplotlib/tests/test_patheffects.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
import platform

import numpy as np

Expand Down Expand Up @@ -30,7 +31,8 @@ def test_patheffect1():


@image_comparison(['patheffect2'], remove_text=True, style='mpl20',
tol=0.051 if sys.platform == 'darwin' else 0)
tol=(0.051 if sys.platform == 'darwin'
or platform.machine() == 'loongarch64' else 0))
def test_patheffect2():

ax2 = plt.subplot()
Expand All @@ -46,7 +48,8 @@ def test_patheffect2():


@image_comparison(['patheffect3'], style='mpl20',
tol=0.02 if sys.platform == 'darwin' else 0)
tol=(0.02 if sys.platform == 'darwin'
or platform.machine() == 'loongarch64' else 0))
def test_patheffect3():
plt.figure(figsize=(8, 6))
p1, = plt.plot([1, 3, 5, 4, 3], 'o-b', lw=4)
Expand Down
7 changes: 5 additions & 2 deletions lib/matplotlib/tests/test_polar.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
import platform

import numpy as np
from numpy.testing import assert_allclose
Expand All @@ -12,7 +13,8 @@


@image_comparison(['polar_axes.png'], style='default',
tol=0.009 if sys.platform == 'darwin' else 0)
tol=(0.009 if sys.platform == 'darwin'
or platform.machine() == 'loongarch64' else 0))
def test_polar_annotations():
# You can specify the xypoint and the xytext in different positions and
# coordinate systems, and optionally turn on a connecting line and mark the
Expand Down Expand Up @@ -47,7 +49,8 @@ def test_polar_annotations():


@image_comparison(['polar_coords.png'], style='default', remove_text=True,
tol=0.013 if sys.platform == 'darwin' else 0)
tol=(0.013 if sys.platform == 'darwin'
or platform.machine() == 'loongarch64' else 0))
def test_polar_coord_annotations():
# You can also use polar notation on a cartesian axes. Here the native
# coordinate system ('data') is cartesian, so you need to specify the
Expand Down
3 changes: 2 additions & 1 deletion lib/mpl_toolkits/mplot3d/tests/test_axes3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -1722,7 +1722,8 @@ def test_errorbar3d_errorevery():


@mpl3d_image_comparison(['errorbar3d.png'], style='mpl20',
tol=0.015 if sys.platform == 'darwin' else 0)
tol=(0.015 if sys.platform == 'darwin'
or platform.machine() == 'loongarch64' else 0))
def test_errorbar3d():
"""Tests limits, color styling, and legend for 3D errorbars."""
fig = plt.figure()
Expand Down
4 changes: 3 additions & 1 deletion lib/mpl_toolkits/mplot3d/tests/test_legend3d.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
import platform

import numpy as np

Expand Down Expand Up @@ -28,7 +29,8 @@ def test_legend_bar():


@image_comparison(['fancy.png'], remove_text=True, style='mpl20',
tol=0.01 if sys.platform == 'darwin' else 0)
tol=(0.01 if sys.platform == 'darwin'
or platform.machine() == 'loongarch64' else 0))
def test_fancy():
fig, ax = plt.subplots(subplot_kw=dict(projection='3d'))
ax.plot(np.arange(10), np.full(10, 5), np.full(10, 5), 'o--', label='line')
Expand Down
Loading