Created
October 7, 2015 14:01
-
-
Save marcdama/02520ffbd11e2067ae87 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(exit=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment