Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import unittest;
- class Test(unittest.TestCase):
- def test_returns_tuple(self):
- isogram = is_isogram('abolishment')
- self.assertIsInstance(isogram, tuple, msg='Does not return a tuple')
- def test_checks_for_isograms(self):
- word = 'abolishment'
- self.assertEqual(
- is_isogram(word),
- (word, True),
- msg="Isogram word, '{}' not detected correctly".format(word)
- )
- def test_returns_false_for_nonisograms(self):
- word = 'alphabet'
- self.assertEqual(
- is_isogram(word),
- (word, False),
- msg="Non isogram word, '{}' falsely detected".format(word)
- )
- def test_it_only_accepts_strings(self):
- with self.assertRaises(TypeError) as context:
- is_isogram(2)
- self.assertEqual(
- 'Argument should be a string',
- context.exception.message,
- 'String inputs allowed only'
- )
- def test_empty_string_input(self):
- word = " "
- self.assertEqual(
- is_isogram(word),
- (word, False),
- msg='Empty string not a avalid isogram'
- )
- def is_Isogram():
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement