beautify equals check msg

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@2917 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2005-10-25 13:47:28 +00:00
parent b28411f54e
commit fa3d35beff
5 changed files with 28 additions and 9 deletions

View file

@ -15,7 +15,23 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
"""
Unit tests for the linkcheck module.
Unit test utilities.
"""
import linkcheck
import unittest
class MsgTestCase (unittest.TestCase):
"""
A test case with improved inequality test.
"""
def failUnlessEqual (self, first, second, msg=None):
"""
Define the first argument as the test value, and the second
one as the excpected value. Adjust the default error message
accordingly.
"""
if msg is None:
msg = "got %r, expected %r" % (first, second)
super(MsgTestCase, self).failUnlessEqual(first, second, msg=msg)
assertEqual = assertEquals = failUnlessEqual

View file

@ -21,9 +21,9 @@ Test container routines.
import unittest
import random
import linkcheck.containers
from linkcheck.tests import MsgTestCase
class TestListDict (unittest.TestCase):
class TestListDict (MsgTestCase):
"""
Test list dictionary routines.
"""
@ -77,7 +77,7 @@ class TestListDict (unittest.TestCase):
self.assertEqual(self.d[k], toinsert[i])
class TestSetList (unittest.TestCase):
class TestSetList (MsgTestCase):
"""
Test set list routines.
"""
@ -129,7 +129,7 @@ class TestSetList (unittest.TestCase):
self.assertEqual(self.l[1], 3)
class TestLRU (unittest.TestCase):
class TestLRU (MsgTestCase):
"""
Test routines of LRU queue.
"""

View file

@ -23,6 +23,7 @@ import linkcheck.HtmlParser.htmlsax
import linkcheck.HtmlParser.htmllib
import cStringIO as StringIO
import unittest
from linkcheck.tests import MsgTestCase
# list of tuples (<test pattern>, <expected parse output>)
@ -138,7 +139,7 @@ flushtests = [
]
class TestParser (unittest.TestCase):
class TestParser (MsgTestCase):
"""
Test html parser.
"""

View file

@ -22,9 +22,10 @@ import unittest
import os
import linkcheck.strformat
from linkcheck.tests import MsgTestCase
class TestStrFormat (unittest.TestCase):
class TestStrFormat (MsgTestCase):
"""
Test string formatting routines.
"""

View file

@ -21,6 +21,7 @@ Test url routines.
import unittest
import os
import linkcheck.url
from linkcheck.tests import MsgTestCase
# 'ftp://user:pass@ftp.foo.net/foo/bar':
# 'ftp://user:pass@ftp.foo.net/foo/bar',
@ -40,7 +41,7 @@ def url_norm (url):
return linkcheck.url.url_norm(url)[0]
class TestUrl (unittest.TestCase):
class TestUrl (MsgTestCase):
"""
Test url norming and quoting.
"""