1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
#! /usr/bin/env python3
# $Id: test_parser.py 9047 2022-03-17 13:40:11Z milde $
# Author: Stefan Rank <strank(AT)strank(DOT)info>
# Copyright: This module has been placed in the public domain.
"""
Tests for basic functionality of parser classes.
"""
import unittest
from docutils import parsers, utils, frontend
class RstParserTests(unittest.TestCase):
def test_inputrestrictions(self):
parser_class = parsers.get_parser_class('rst')
parser = parser_class()
document = utils.new_document('test data',
frontend.get_default_settings(parser))
# input must be unicode at all times
self.assertRaises(TypeError, parser.parse, b'hol', document)
if __name__ == '__main__':
unittest.main()
|