Buckets:
ktongue/docker_container / simsite /venv /lib /python3.14 /site-packages /matplotlib /tests /test_texmanager.py
| import os | |
| from pathlib import Path | |
| import re | |
| import sys | |
| import pytest | |
| import matplotlib.pyplot as plt | |
| from matplotlib.testing import subprocess_run_for_testing | |
| from matplotlib.testing._markers import needs_usetex | |
| from matplotlib.texmanager import TexManager | |
| def test_fontconfig_preamble(): | |
| """Test that the preamble is included in the source.""" | |
| plt.rcParams['text.usetex'] = True | |
| src1 = TexManager()._get_tex_source("", fontsize=12) | |
| plt.rcParams['text.latex.preamble'] = '\\usepackage{txfonts}' | |
| src2 = TexManager()._get_tex_source("", fontsize=12) | |
| assert src1 != src2 | |
| def test_font_selection(rc, preamble, family): | |
| plt.rcParams.update(rc) | |
| tm = TexManager() | |
| src = Path(tm.make_tex("hello, world", fontsize=12)).read_text() | |
| assert preamble in src | |
| assert [*re.findall(r"\\\w+family", src)] == [family] | |
| def test_unicode_characters(): | |
| # Smoke test to see that Unicode characters does not cause issues | |
| # See #23019 | |
| plt.rcParams['text.usetex'] = True | |
| fig, ax = plt.subplots() | |
| ax.set_ylabel('\\textit{Velocity (\N{DEGREE SIGN}/sec)}') | |
| ax.set_xlabel('\N{VULGAR FRACTION ONE QUARTER}Öøæ') | |
| fig.canvas.draw() | |
| # But not all characters. | |
| # Should raise RuntimeError, not UnicodeDecodeError | |
| with pytest.raises(RuntimeError): | |
| ax.set_title('\N{SNOWMAN}') | |
| fig.canvas.draw() | |
| def test_openin_any_paranoid(): | |
| completed = subprocess_run_for_testing( | |
| [sys.executable, "-c", | |
| 'import matplotlib.pyplot as plt;' | |
| 'plt.rcParams.update({"text.usetex": True});' | |
| 'plt.title("paranoid");' | |
| 'plt.show(block=False);'], | |
| env={**os.environ, 'openin_any': 'p'}, check=True, capture_output=True) | |
| assert completed.stderr == "" | |
Xet Storage Details
- Size:
- 2.65 kB
- Xet hash:
- a3978c1e464d0ff8151d321a7a7f695418329f96fb8429aa3b0d93bf21e4859c
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.