base.py 466 B

1234567891011121314151617181920
  1. """
  2. Contains base test class for nbformat
  3. """
  4. # Copyright (c) IPython Development Team.
  5. # Distributed under the terms of the Modified BSD License.
  6. import os
  7. import unittest
  8. import io
  9. class TestsBase(unittest.TestCase):
  10. """Base tests class."""
  11. def fopen(self, f, mode=u'r',encoding='utf-8'):
  12. return io.open(os.path.join(self._get_files_path(), f), mode, encoding=encoding)
  13. def _get_files_path(self):
  14. return os.path.dirname(__file__)