Opened 16 years ago
Closed 16 years ago
#7297 closed (wontfix)
utils.text docstrings inaccurate, not testable with doctest.testmod
Reported by: | Antti Kaihola | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The code examples in the docstrings of [source:django/trunk/django/utils/text.py django.utils.text] can't be tested with doctest.testmod because of Python's issue 1108. A simple work-around would be to copy docstrings of individual functions to the module's __doc__
variable.
Also, the code examples are not accurate. Attached is a doctest.testmod run after fixing the doctest issue.
Attachments (3)
Change History (5)
by , 16 years ago
Attachment: | 7297.doctest_run.txt added |
---|
by , 16 years ago
Attachment: | 7297.1.diff added |
---|
Work-around for #7297 doctest problem and corrections to code examples in utils.text
by , 16 years ago
Attachment: | 7297.2.diff added |
---|
Added explanation and code examples to smart_split() to illustrate its un-escaping behavior.
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
I'm wontfixing the last part of this patch (introducing a doc setting to get around Python 1108) because it opens a window for a future failure to creep in - if we add a new method with a doctest, it's entirely possible that we could forget to put it in the doc setting, simply because that isn't a normal requirement for such doctests.
On top of that, the actual utils.text tests are in tests.regressiontests.tests. Since these tests aren't an essential part of Django's test suite, I'm not inclined to introduce a workaround to a problem we're not really having.
Failures of django.utils.text doctests