| Server IP : 35.80.110.71 / Your IP : 216.73.216.221 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /proc/thread-self/root/lib/python3/dist-packages/matplotlib/tests/ |
Upload File : |
import builtins
import os
import subprocess
import sys
import textwrap
def test_simple():
assert 1 + 1 == 2
def test_override_builtins():
import pylab
ok_to_override = {
'__name__',
'__doc__',
'__package__',
'__loader__',
'__spec__',
'any',
'all',
'sum',
'divmod'
}
overridden = {key for key in {*dir(pylab)} & {*dir(builtins)}
if getattr(pylab, key) != getattr(builtins, key)}
assert overridden <= ok_to_override
def test_lazy_imports():
source = textwrap.dedent("""
import sys
import matplotlib.figure
import matplotlib.backend_bases
import matplotlib.pyplot
assert 'matplotlib._tri' not in sys.modules
assert 'matplotlib._qhull' not in sys.modules
assert 'matplotlib._contour' not in sys.modules
assert 'urllib.request' not in sys.modules
""")
subprocess.check_call(
[sys.executable, '-c', source],
env={**os.environ, "MPLBACKEND": "", "MATPLOTLIBRC": os.devnull})