1 #! /usr/bin/env python3
3 # Author: David Goodger <goodger@python.org>
4 # Copyright: This module has been placed in the public domain.
7 Tests of document tree pickling.
10 from pathlib
import Path
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__':