MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_font_path

Function test_font_path

lib/matplotlib/tests/test_font_manager.py:29–58  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27
28
29def test_font_path():
30 fp = FontPath('foo', 123)
31 fp2 = FontPath('foo', 321)
32 assert str(fp) == 'foo'
33 assert repr(fp) == "FontPath('foo', 123)"
34 assert fp.path == 'foo'
35 assert fp.face_index == 123
36 # Should be immutable.
37 with pytest.raises(AttributeError, match='has no setter'):
38 fp.path = 'bar'
39 with pytest.raises(AttributeError, match='has no setter'):
40 fp.face_index = 321
41 # Should be comparable with str and itself.
42 assert fp == 'foo'
43 assert fp == FontPath('foo', 123)
44 assert fp <= fp
45 assert fp >= fp
46 assert fp != fp2
47 assert fp < fp2
48 assert fp <= fp2
49 assert fp2 > fp
50 assert fp2 >= fp
51 # Should be hashable, but not the same as str.
52 d = {fp: 1, 'bar': 2}
53 assert fp in d
54 assert d[fp] == 1
55 assert d[FontPath('foo', 123)] == 1
56 assert fp2 not in d
57 assert 'foo' not in d
58 assert FontPath('bar', 0) not in d
59
60
61def test_font_priority():

Callers

nothing calls this directly

Calls 1

FontPathClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…