[test] run and fix utils and uilib doctests stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 28 Jun 2011 16:32:38 +0200
branchstable
changeset 7568 c5ee33fb6a3b
parent 7567 d6366de1d0dc
child 7569 02c338197322
child 7571 6386f802fbc6
[test] run and fix utils and uilib doctests
test/unittest_uilib.py
test/unittest_utils.py
utils.py
--- a/test/unittest_uilib.py	Tue Jun 28 13:16:09 2011 +0200
+++ b/test/unittest_uilib.py	Tue Jun 28 16:32:38 2011 +0200
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
 #
 # This file is part of CubicWeb.
@@ -22,14 +22,15 @@
 
 
 import pkg_resources
-from logilab.common.testlib import TestCase, unittest_main
+
 from unittest2 import skipIf
 
+from logilab.common.testlib import DocTest, TestCase, unittest_main
+
 from cubicweb import uilib
 
 lxml_version = pkg_resources.get_distribution('lxml').version.split('.')
 
-
 class UILIBTC(TestCase):
 
     def test_remove_tags(self):
@@ -185,6 +186,10 @@
         self.assertMultiLineEqual(uilib.soup2xhtml(incoming, 'ascii'), expected)
 
 
+class DocTest(DocTest):
+    module = uilib
+
+
 if __name__ == '__main__':
     unittest_main()
 
--- a/test/unittest_utils.py	Tue Jun 28 13:16:09 2011 +0200
+++ b/test/unittest_utils.py	Tue Jun 28 16:32:38 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
 #
 # This file is part of CubicWeb.
@@ -21,7 +21,7 @@
 import decimal
 import datetime
 
-from logilab.common.testlib import TestCase, unittest_main
+from logilab.common.testlib import TestCase, DocTest, unittest_main
 
 from cubicweb.utils import make_uid, UStringIO, SizeConstrainedList, RepeatList
 from cubicweb.entity import Entity
@@ -156,5 +156,8 @@
         self.assertEqual(self.encode(TestCase), 'null')
 
 
+class DocTest(DocTest):
+    from cubicweb import utils as module
+
 if __name__ == '__main__':
     unittest_main()
--- a/utils.py	Tue Jun 28 13:16:09 2011 +0200
+++ b/utils.py	Tue Jun 28 16:32:38 2011 +0200
@@ -130,11 +130,11 @@
 
 
 class SizeConstrainedList(list):
-    """simple list that makes sure the list does not get bigger
-    than a given size.
+    """simple list that makes sure the list does not get bigger than a given
+    size.
 
-    when the list is full and a new element is added, the first
-    element of the list is removed before appending the new one
+    when the list is full and a new element is added, the first element of the
+    list is removed before appending the new one
 
     >>> l = SizeConstrainedList(2)
     >>> l.append(1)
@@ -142,6 +142,7 @@
     >>> l
     [1, 2]
     >>> l.append(3)
+    >>> l
     [2, 3]
     """
     def __init__(self, maxsize):