test_matplotlib.py 706 B

123456789101112131415161718192021
  1. import matplotlib
  2. import matplotlib.rcsetup
  3. def test_use_doc_standard_backends():
  4. """
  5. Test that the standard backends mentioned in the docstring of
  6. matplotlib.use() are the same as in matplotlib.rcsetup.
  7. """
  8. def parse(key):
  9. backends = []
  10. for line in matplotlib.use.__doc__.split(key)[1].split('\n'):
  11. if not line.strip():
  12. break
  13. backends += [e.strip() for e in line.split(',') if e]
  14. return backends
  15. assert (set(parse('- interactive backends:\n')) ==
  16. set(matplotlib.rcsetup.interactive_bk))
  17. assert (set(parse('- non-interactive backends:\n')) ==
  18. set(matplotlib.rcsetup.non_interactive_bk))