Download lib/python3.12/site-packages/matplotlib/tests/test_backend_webagg.py from parallel-reasoner/env-full: direct link, hf CLI and curl.
- Browser
- Download file 938 Bytes
-
https://huggingface.co/parallel-reasoner/env-full/resolve/ea1f43ebf2331233a09cb8dff46d5ff5659780c0/lib/python3.12/site-packages/matplotlib/tests/test_backend_webagg.py
- Command line
-
hf download hf://parallel-reasoner/env-full@ea1f43ebf2331233a09cb8dff46d5ff5659780c0/lib/python3.12/site-packages/matplotlib/tests/test_backend_webagg.py
-
curl -L -o test_backend_webagg.py https://huggingface.co/parallel-reasoner/env-full/resolve/ea1f43ebf2331233a09cb8dff46d5ff5659780c0/lib/python3.12/site-packages/matplotlib/tests/test_backend_webagg.py
938 Bytes
| import os | |
| import sys | |
| import pytest | |
| import matplotlib.backends.backend_webagg_core | |
| from matplotlib.testing import subprocess_run_for_testing | |
| def test_webagg_fallback(backend): | |
| pytest.importorskip("tornado") | |
| if backend == "nbagg": | |
| pytest.importorskip("IPython") | |
| env = dict(os.environ) | |
| if sys.platform != "win32": | |
| env["DISPLAY"] = "" | |
| env["MPLBACKEND"] = backend | |
| test_code = ( | |
| "import os;" | |
| + f"assert os.environ['MPLBACKEND'] == '{backend}';" | |
| + "import matplotlib.pyplot as plt; " | |
| + "print(plt.get_backend());" | |
| f"assert '{backend}' == plt.get_backend().lower();" | |
| ) | |
| subprocess_run_for_testing([sys.executable, "-c", test_code], env=env, check=True) | |
| def test_webagg_core_no_toolbar(): | |
| fm = matplotlib.backends.backend_webagg_core.FigureManagerWebAgg | |
| assert fm._toolbar2_class is None | |