This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ezio.melotti
Recipients docs@python, eric.araujo, ezio.melotti, michael.foord, ncoghlan, rhettinger
Date 2011-03-11.18:15:41
SpamBayes Score 5.546436e-08
Marked as misclassified No
Message-id <1299867342.41.0.388080450116.issue11468@psf.upfronthosting.co.za>
In-reply-to
Content
The current example[0] uses assertTrue(element in self.seq) but it would be better to use assertIn instead.  The whole example could be changed to something simpler that uses only the assertTrue/assertEqual/assertRaises methods correctly, e.g.:

import unittest

class TestStringMethods(unittest.TestCase):

    def test_upper(self):
        self.assertEqual('foo'.upper(), 'FOO')

    def test_isupper(self):
        self.assertTrue('FOO'.isupper())
        self.assertFalse('Foo'.isupper())

    def test_split(self):
        s = 'hello world'
        self.assertEqual(s.split(), ['hello', 'world'])
        # check that s.split fails when the separator is not a string
        with self.assertRaises(TypeError):
            s.split(2)

if __name__ == '__main__':
    unittest.main()

[0]: http://docs.python.org/py3k/library/unittest.html#basic-example
History
Date User Action Args
2011-03-11 18:15:42ezio.melottisetrecipients: + ezio.melotti, rhettinger, ncoghlan, eric.araujo, michael.foord, docs@python
2011-03-11 18:15:42ezio.melottisetmessageid: <1299867342.41.0.388080450116.issue11468@psf.upfronthosting.co.za>
2011-03-11 18:15:41ezio.melottilinkissue11468 messages
2011-03-11 18:15:41ezio.melotticreate