Writing tests for the Python bug tracker

Mark Dickinson dickinsm at gmail.com
Sat Mar 20 07:00:31 EDT 2010


On Mar 20, 6:52 am, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> I've found this:
>
> http://docs.python.org/library/test.html
>
> and I've written a small test:
>
> $ cat test_unicode_interpolation.py
> # For testinghttp://bugs.python.org/issue8128
>
> import test.test_support
> import unittest
>
> class K(unicode):
>     def __str__(self): return "Surprise!"
>
> class UnicodeInterpolationTest(unittest.TestCase):
>     def test_interpolation(self):
>         self.assertEquals(u'%s' % K('some text'), 'Surprise!')
>
> def test_main():
>     test.test_support.run_unittest(UnicodeInterpolationTest)
>
> if __name__ == "__main__":
>     test_main()

This looks like a fine start to me.  I have a feeling that the current
fashion is for assertEqual rather than assertEquals, but I might be
wrong.  :)

--
Mark



More information about the Python-list mailing list