test_python.py 748 B

123456789101112131415161718192021222324
  1. """Tests for PythonExporter"""
  2. # Copyright (c) IPython Development Team.
  3. # Distributed under the terms of the Modified BSD License.
  4. from .base import ExportersTestsBase
  5. from ..python import PythonExporter
  6. class TestPythonExporter(ExportersTestsBase):
  7. """Tests for PythonExporter"""
  8. exporter_class = PythonExporter
  9. should_include_raw = ['python']
  10. def test_constructor(self):
  11. """Can a PythonExporter be constructed?"""
  12. self.exporter_class()
  13. def test_export(self):
  14. """Can a PythonExporter export something?"""
  15. (output, resources) = self.exporter_class().from_filename(self._get_notebook())
  16. self.assertIn("coding: utf-8", output)
  17. self.assertIn("#!/usr/bin/env python", output)