SF.net SVN: docutils:[9578 ] trunk/docutils/test/test _parsers

milde--- via Docutils-checkins <[email protected]>
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 9578
          http://sourceforge.net/p/docutils/code/9578
Author:   milde
Date:     2024-03-17 23:30:40 +0000 (Sun, 17 Mar 2024)
Log Message:
-----------
Move/rename parser test testing only "rst" to the rst parser test dir.

The test skript "parsers/test_parser.py" tests only what happens
if the "rst" parser is fed `bytes` input (a TypeError).

This is OK for "rst", but other parsers don't need to have this
restriction.

Move to the "test_rst/" sub-directory and rename to "test_misc.py".

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

Removed Paths:
-------------
    trunk/docutils/test/test_parsers/test_parser.py

Deleted: trunk/docutils/test/test_parsers/test_parser.py
===================================================================
--- trunk/docutils/test/test_parsers/test_parser.py	2024-03-16 17:03:29 UTC (rev 9577)
+++ trunk/docutils/test/test_parsers/test_parser.py	2024-03-17 23:30:40 UTC (rev 9578)
@@ -1,34 +0,0 @@
-#! /usr/bin/env python3
-# $Id$
-# 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.
-"""
-
-from pathlib import Path
-import sys
-import unittest
-
-if __name__ == '__main__':
-    # prepend the "docutils root" to the Python library path
-    # so we import the local `docutils` package.
-    sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
-
-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()

Copied: trunk/docutils/test/test_parsers/test_rst/test_misc.py (from rev 9577, trunk/docutils/test/test_parsers/test_parser.py)
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_misc.py	                        (rev 0)
+++ trunk/docutils/test/test_parsers/test_rst/test_misc.py	2024-03-17 23:30:40 UTC (rev 9578)
@@ -0,0 +1,34 @@
+#! /usr/bin/env python3
+# $Id$
+# 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.
+"""
+
+from pathlib import Path
+import sys
+import unittest
+
+if __name__ == '__main__':
+    # 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
+
+
+class RstParserTests(unittest.TestCase):
+
+    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()
+        document = utils.new_document('test data',
+                                      frontend.get_default_settings(parser))
+        with self.assertRaises(TypeError):
+            parser.parse(b'hol', document)
+
+
+if __name__ == '__main__':
+    unittest.main()

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.