Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2014
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.96 KB | None | 0 0
  1. try:
  2.     import bob
  3. except ImportError:
  4.     raise SystemExit('Could not find bob.py. Does it exist?')
  5.  
  6. import unittest
  7.  
  8. class BobTests(unittest.TestCase):
  9.     def setUp(self):
  10.         self.bob = bob.Bob()
  11.  
  12.     def test_stating_something(self):
  13.         self.assertEqual(
  14.             'Whatever.',
  15.             self.bob.hey('Tom-ay-to, tom-aaaah-to.')
  16.         )
  17.  
  18.     def test_shouting(self):
  19.         self.assertEqual(
  20.             'Woah, chill out!',
  21.             self.bob.hey('WATCH OUT!')
  22.         )
  23.  
  24.     def test_asking_a_question(self):
  25.         self.assertEqual(
  26.             'Sure.',
  27.             self.bob.hey('Does this cryogenic chamber make me look fat?')
  28.         )
  29.  
  30.     def test_asking_a_numeric_question(self):
  31.         self.assertEqual(
  32.             'Sure.',
  33.             self.bob.hey('You are, what, like 15?')
  34.         )
  35.  
  36.     def test_talking_forcefully(self):
  37.         self.assertEqual(
  38.             'Whatever.',
  39.             self.bob.hey("Let's go make out behind the gym!")
  40.         )
  41.  
  42.     def test_using_acronyms_in_regular_speech(self):
  43.         self.assertEqual(
  44.             'Whatever.', self.bob.hey("It's OK if you don't want to go to the DMV.")
  45.         )
  46.  
  47.     def test_forceful_questions(self):
  48.         self.assertEqual(
  49.             'Woah, chill out!', self.bob.hey('WHAT THE HELL WERE YOU THINKING?')
  50.         )
  51.  
  52.     def test_shouting_numbers(self):
  53.         self.assertEqual(
  54.             'Woah, chill out!', self.bob.hey('1, 2, 3 GO!')
  55.         )
  56.  
  57.     def test_only_numbers(self):
  58.         self.assertEqual(
  59.             'Whatever.', self.bob.hey('1, 2, 3')
  60.         )
  61.  
  62.     def test_question_with_only_numbers(self):
  63.         self.assertEqual(
  64.             'Sure.', self.bob.hey('4?')
  65.         )
  66.  
  67.     def test_shouting_with_special_characters(self):
  68.         self.assertEqual(
  69.             'Woah, chill out!', self.bob.hey('ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!')
  70.         )
  71.  
  72.     def test_shouting_with_umlauts(self):
  73.         self.assertEqual(
  74.             'Woah, chill out!', self.bob.hey(u"\xdcML\xc4\xdcTS!")
  75.         )
  76.  
  77.     def test_calmly_speaking_with_umlauts(self):
  78.         self.assertEqual(
  79.             'Whatever.', self.bob.hey(u"\xdcML\xe4\xdcTS!")
  80.         )
  81.  
  82.     def test_shouting_with_no_exclamation_mark(self):
  83.         self.assertEqual(
  84.             'Woah, chill out!', self.bob.hey('I HATE YOU')
  85.         )
  86.  
  87.     def test_statement_containing_question_mark(self):
  88.         self.assertEqual(
  89.             'Whatever.', self.bob.hey('Ending with ? means a question.')
  90.         )
  91.  
  92.     def test_prattling_on(self):
  93.         self.assertEqual(
  94.             'Sure.', self.bob.hey("Wait! Hang on. Are you going to be OK?")
  95.         )
  96.  
  97.     def test_silence(self):
  98.         self.assertEqual(
  99.             'Fine. Be that way!', self.bob.hey('')
  100.         )
  101.  
  102.     def test_prolonged_silence(self):
  103.         self.assertEqual(
  104.             'Fine. Be that way!', self.bob.hey('    ')
  105.         )
  106.  
  107. if __name__ == '__main__':
  108.     unittest.main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement