Skip to content
Merged
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
3 changes: 3 additions & 0 deletions lib/matplotlib/tests/test_font_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ def _model_handler(_):
reason='emscripten does not support subprocesses')
@pytest.mark.skipif(not hasattr(os, "register_at_fork"),
reason="Cannot register at_fork handlers")
# Python 3.15+ raises DeprecationWarning for fork in multi-threaded process
@pytest.mark.filterwarnings("ignore:.*multi-threaded.*fork.*:DeprecationWarning")
@pytest.mark.filterwarnings("ignore:.*multi-threaded.*fork.*:RuntimeWarning")
def test_fork():
_model_handler(0) # Make sure the font cache is filled.
ctx = multiprocessing.get_context("fork")
Expand Down
26 changes: 14 additions & 12 deletions lib/matplotlib/tests/test_rcparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,32 +73,34 @@ def func():


def test_RcParams_class():
rc = mpl.RcParams({'font.cursive': ['Apple Chancery',
'Textile',
'Zapf Chancery',
'cursive'],
rc = mpl.RcParams({'font.cursive': ['Zapf Chancery', 'cursive'],
'font.family': 'sans-serif',
'font.weight': 'normal',
'font.size': 12})

expected_repr = """
RcParams({'font.cursive': ['Apple Chancery',
'Textile',
'Zapf Chancery',
'cursive'],
RcParams({
'font.cursive': ['Zapf Chancery', 'cursive'],
'font.family': ['sans-serif'],
'font.size': 12.0,
'font.weight': 'normal'})""".lstrip()
'font.weight': 'normal',
})""".lstrip()

assert expected_repr == repr(rc)
actual_repr = repr(rc)
if sys.version_info[:2] < (3, 15):
actual_repr = (actual_repr
.replace("{'", "{\n '")
.replace("'}", "',\n }"))

assert actual_repr == expected_repr

expected_str = """
font.cursive: ['Apple Chancery', 'Textile', 'Zapf Chancery', 'cursive']
font.cursive: ['Zapf Chancery', 'cursive']
font.family: ['sans-serif']
font.size: 12.0
font.weight: normal""".lstrip()

assert expected_str == str(rc)
assert str(rc) == expected_str

# test the find_all functionality
assert ['font.cursive', 'font.size'] == sorted(rc.find_all('i[vz]'))
Expand Down
Loading