From: <fel...@us...> - 2005-06-27 20:29:18
|
Author: felixwiemann Date: 2005-06-27 22:29:10 +0200 (Mon, 27 Jun 2005) New Revision: 3606 Modified: trunk/docutils/docutils/core.py trunk/docutils/test/test_transforms.py Log: added assert to get a helpful error message when passing things like "writer='html'" to publish_* Modified: trunk/docutils/docutils/core.py =================================================================== --- trunk/docutils/docutils/core.py 2005-06-27 14:45:14 UTC (rev 3605) +++ trunk/docutils/docutils/core.py 2005-06-27 20:29:10 UTC (rev 3606) @@ -18,6 +18,7 @@ import sys import pprint +from types import StringType from docutils import __version__, __version_details__, SettingsSpec from docutils import frontend, io, utils, readers, writers from docutils.frontend import OptionParser @@ -52,6 +53,11 @@ self.writer = writer """A `docutils.writers.Writer` instance.""" + for component in 'reader', 'parser', 'writer': + assert not isinstance(getattr(self, component), StringType), \ + ('passed string as "%s" parameter; use "%s_name" instead' + % (getattr(self, component), component, component)) + self.source = source """The source of input data, a `docutils.io.Input` instance.""" Modified: trunk/docutils/test/test_transforms.py =================================================================== --- trunk/docutils/test/test_transforms.py 2005-06-27 14:45:14 UTC (rev 3605) +++ trunk/docutils/test/test_transforms.py 2005-06-27 20:29:10 UTC (rev 3606) @@ -14,6 +14,7 @@ import unittest + class TestTransform(transforms.Transform): default_priority = 100 @@ -24,6 +25,7 @@ self.applied += 1 self.kwargs = kwargs + class KwargsTestCase(unittest.TestCase): def test_kwargs(self): |