Debian Codegraph @

test/test_parsers/test_rst/test_misc.py

raw symbols SCIP
1 #! /usr/bin/env python3
2 # $Id: test_misc.py 10205 2025-08-19 15:07:47Z milde $
3 # Author: Stefan Rank <strank(AT)strank(DOT)info>
4 # Copyright: This module has been placed in the public domain.
5
6 """
7 Tests for basic functionality of parser classes.
8 """
9
10 from pathlib import Path
11 import sys
12 import unittest
13
14 if __name__ == '__main__':
15 # prepend the local "docutils root" to the Python library path
16 sys.path.insert(0, Path(__file__).resolve().parents[2].as_posix())
17
18 from docutils import frontend, utils
19 import docutils.parsers.rst
20
21
22 class RstParserTests(unittest.TestCase):
23
24 def test_inputrestrictions(self):
25 # input must be unicode at all times, check for meaningful Exception
26 parser = docutils.parsers.rst.Parser()
27 document = utils.new_document('test data',
28 frontend.get_default_settings(parser))
29 with self.assertRaises(TypeError):
30 parser.parse(b'hol', document)
31
32
33 if __name__ == '__main__':
34 unittest.main()