()
| 27 | |
| 28 | |
| 29 | def 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 | |
| 61 | def test_font_priority(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…