SF.net SVN: docutils:[9644 ] trunk/docutils/test/test _parsers/test_rst/test_misc .py

milde--- via Docutils-checkins <[email protected]>
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 9644
          http://sourceforge.net/p/docutils/code/9644
Author:   milde
Date:     2024-04-15 18:34:05 +0000 (Mon, 15 Apr 2024)
Log Message:
-----------
Small test speedup/simplification.

Directly instantiating the parser class brings down test time from 0.022 s to 0.005 s
while `parsers.get_parser_class()` is tested separately.

Modified Paths:
--------------
    trunk/docutils/test/test_parsers/test_rst/test_misc.py

Modified: trunk/docutils/test/test_parsers/test_rst/test_misc.py
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_misc.py	2024-04-15 12:27:49 UTC (rev 9643)
+++ trunk/docutils/test/test_parsers/test_rst/test_misc.py	2024-04-15 18:34:05 UTC (rev 9644)
@@ -15,7 +15,8 @@
     # prepend the local "docutils root" to the Python library path
     sys.path.insert(0, Path(__file__).resolve().parents[2].as_posix())
 
-from docutils import parsers, utils, frontend
+from docutils import frontend, utils
+import docutils.parsers.rst
 
 
 class RstParserTests(unittest.TestCase):
@@ -22,8 +23,7 @@
 
     def test_inputrestrictions(self):
         # input must be unicode at all times, check for meaningful Exception
-        parser_class = parsers.get_parser_class('rst')
-        parser = parser_class()
+        parser = docutils.parsers.rst.Parser()
         document = utils.new_document('test data',
                                       frontend.get_default_settings(parser))
         with self.assertRaises(TypeError):

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.