File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import io
22from pathlib import Path
3+ import warnings
34
45import numpy as np
56from numpy .testing import assert_array_almost_equal
@@ -258,12 +259,18 @@ def test_draw_path_collection_error_handling():
258259
259260@image_comparison (["font_fallback.png" ])
260261def test_font_fallback ():
261- fp = fm .FontProperties (family = ["Noto Sans CJK JP" ])
262+ fp = fm .FontProperties (family = ["Noto Sans CJK SC" , "Noto Sans CJK JP" ])
262263 name = Path (fm .findfont (fp )).name
263264 if name not in ("NotoSansCJKsc-Regular.otf" , "NotoSansCJK-Regular.ttc" ):
264- pytest .skip (f"Noto Sans CJK JP font may be missing, found: { name } " )
265+ pytest .skip (f"Noto Sans CJK SC font may be missing, found: { name } " )
265266
266- plt .rc ('font' , family = ['DejaVu Sans' , 'Noto Sans CJK JP' ], size = 15 )
267+ plt .rc ('font' , family = [
268+ 'DejaVu Sans' , 'Noto Sans CJK JP' , 'Noto Sans CJK SC'
269+ ], size = 15 )
267270
268271 fig , ax = plt .subplots ()
269272 ax .text (0.25 , 0.475 , "There are 多个汉字 in between!" )
273+
274+ with warnings .catch_warnings ():
275+ warnings .filterwarnings ('ignore' , 'findfont: Font family.*not found' )
276+ fig .canvas .draw ()
You can’t perform that action at this time.
0 commit comments