Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.2.X] Converted contrib/webdesign doctests to unittests. We thoroug…

…hly deplore those doctests.

Backport of [14101] from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14103 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit a92da6e80b840ba7874e6faebd54d50be85ab1ae 1 parent cf2e9f6
Luke Plant authored

Showing 1 changed file with 15 additions and 14 deletions. Show diff stats Hide diff stats

  1. 29  django/contrib/webdesign/tests.py
29  django/contrib/webdesign/tests.py
... ...
@@ -1,20 +1,21 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 
3  
-r"""
4  
->>> words(7)
5  
-u'lorem ipsum dolor sit amet consectetur adipisicing'
  3
+import unittest
6 4
 
7  
->>> paragraphs(1)
8  
-['Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.']
  5
+from django.contrib.webdesign.lorem_ipsum import *
  6
+from django.template import loader, Context
9 7
 
10  
->>> from django.template import loader, Context
11  
->>> t = loader.get_template_from_string("{% load webdesign %}{% lorem 3 w %}")
12  
->>> t.render(Context({}))
13  
-u'lorem ipsum dolor'
14  
-"""
15 8
 
16  
-from django.contrib.webdesign.lorem_ipsum import *
  9
+class WebdesignTest(unittest.TestCase):
  10
+
  11
+    def test_words(self):
  12
+        self.assertEqual(words(7), u'lorem ipsum dolor sit amet consectetur adipisicing')
  13
+
  14
+    def test_paragraphs(self):
  15
+        self.assertEqual(paragraphs(1),
  16
+                         ['Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'])
17 17
 
18  
-if __name__ == '__main__':
19  
-    import doctest
20  
-    doctest.testmod()
  18
+    def test_lorem_tag(self):
  19
+        t = loader.get_template_from_string("{% load webdesign %}{% lorem 3 w %}")
  20
+        self.assertEqual(t.render(Context({})),
  21
+                         u'lorem ipsum dolor')

0 notes on commit a92da6e

Please sign in to comment.
Something went wrong with that request. Please try again.