Code

Opened 8 years ago

Closed 8 years ago

#2847 closed defect (invalid)

[patch] commetn doctest broken

Reported by: Maximillian Dornseif <md@…> Owned by: adrian
Component: Contrib apps Version: master
Severity: minor Keywords:
Cc: md@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

It seems to me that a docstring in the comment model is broken - it can't wor without instantating an object. And this resultet in python manage.py test failing for my project. See below for the exact error. Since the comment system is meant to be rewritten I spent no time further investigating the issue but just disabled the docstring like this:

+++ django/contrib/comments/models.py   (working copy)
     def get_rating_options(self, rating_string):
[...]
-        >>> s = "scale:1-10|First_category|Second_category"
-        >>> get_rating_options(s)
+        >> s = "scale:1-10|First_category|Second_category"
+        >> get_rating_options(s)

(full patch at http://c0re.23.nu/c0de/misc/django-3884-comment_doctests.py#)

Error message:

======================================================================
FAIL: Doctest: django.contrib.comments.models.CommentManager.get_rating_options
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/private/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/test/doctest.py", line 2156, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for django.contrib.comments.models.CommentManager.get_rating_options
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/contrib/comments/models.py", line 33, in get_rating_options

----------------------------------------------------------------------
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/contrib/comments/models.py", line 37, in django.contrib.comments.models.CommentManager.get_rating_options
Failed example:
    get_rating_options(s)
Exception raised:
    Traceback (most recent call last):
      File "/private/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/test/doctest.py", line 1243, in __run
        compileflags, 1) in test.globs
      File "<doctest django.contrib.comments.models.CommentManager.get_rating_options[1]>", line 1, in ?
        get_rating_options(s)
    NameError: name 'get_rating_options' is not defined

Attachments (0)

Change History (1)

comment:1 Changed 8 years ago by Maximillian Dornseif <md@…>

  • Resolution set to invalid
  • Status changed from new to closed

double submit

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.