tox does not test with unsupported python versions.
[docutils.git] / docutils / test / test_pickle.py
blob424def19acb43572957171e5db0b6cb7b08a9e05
1 #! /usr/bin/env python3
2 # $Id$
3 # Author: David Goodger <goodger@python.org>
4 # Copyright: This module has been placed in the public domain.
6 """
7 Tests of document tree pickling.
8 """
10 from pathlib import Path
11 import pickle
12 import sys
13 import unittest
15 if __name__ == '__main__':
16 # prepend the "docutils root" to the Python library path
17 # so we import the local `docutils` package.
18 sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
20 from docutils import core
23 class PickleTests(unittest.TestCase):
25 def test_pickle(self):
26 doctree = core.publish_doctree(
27 source='Title\n=====\n\nparagraph\n',
28 settings_overrides={'_disable_config': True})
29 dill = pickle.dumps(doctree)
30 reconstituted = pickle.loads(dill)
31 self.assertEqual(doctree.pformat(), reconstituted.pformat())
34 if __name__ == '__main__':
35 unittest.main()