|
1 | 1 | import unittest |
2 | 2 |
|
3 | | -from bob import hey |
| 3 | +from bob import response |
4 | 4 |
|
5 | 5 |
|
6 | 6 | # Tests adapted from `problem-specifications//canonical-data.json` @ v1.4.0 |
7 | 7 |
|
8 | 8 | class BobTest(unittest.TestCase): |
9 | 9 | def test_stating_something(self): |
10 | | - self.assertEqual(hey("Tom-ay-to, tom-aaaah-to."), "Whatever.") |
| 10 | + self.assertEqual(response("Tom-ay-to, tom-aaaah-to."), "Whatever.") |
11 | 11 |
|
12 | 12 | def test_shouting(self): |
13 | | - self.assertEqual(hey("WATCH OUT!"), "Whoa, chill out!") |
| 13 | + self.assertEqual(response("WATCH OUT!"), "Whoa, chill out!") |
14 | 14 |
|
15 | 15 | def test_shouting_gibberish(self): |
16 | | - self.assertEqual(hey("FCECDFCAAB"), "Whoa, chill out!") |
| 16 | + self.assertEqual(response("FCECDFCAAB"), "Whoa, chill out!") |
17 | 17 |
|
18 | 18 | def test_asking_a_question(self): |
19 | 19 | self.assertEqual( |
20 | | - hey("Does this cryogenic chamber make me look fat?"), "Sure.") |
| 20 | + response("Does this cryogenic chamber make me look fat?"), "Sure.") |
21 | 21 |
|
22 | 22 | def test_asking_a_numeric_question(self): |
23 | | - self.assertEqual(hey("You are, what, like 15?"), "Sure.") |
| 23 | + self.assertEqual(response("You are, what, like 15?"), "Sure.") |
24 | 24 |
|
25 | 25 | def test_asking_gibberish(self): |
26 | | - self.assertEqual(hey("fffbbcbeab?"), "Sure.") |
| 26 | + self.assertEqual(response("fffbbcbeab?"), "Sure.") |
27 | 27 |
|
28 | 28 | def test_talking_forcefully(self): |
29 | 29 | self.assertEqual( |
30 | | - hey("Let's go make out behind the gym!"), "Whatever.") |
| 30 | + response("Let's go make out behind the gym!"), "Whatever.") |
31 | 31 |
|
32 | 32 | def test_using_acronyms_in_regular_speech(self): |
33 | 33 | self.assertEqual( |
34 | | - hey("It's OK if you don't want to go to the DMV."), |
| 34 | + response("It's OK if you don't want to go to the DMV."), |
35 | 35 | "Whatever.") |
36 | 36 |
|
37 | 37 | def test_forceful_question(self): |
38 | 38 | self.assertEqual( |
39 | | - hey("WHAT THE HELL WERE YOU THINKING?"), |
| 39 | + response("WHAT THE HELL WERE YOU THINKING?"), |
40 | 40 | "Calm down, I know what I'm doing!" |
41 | 41 | ) |
42 | 42 |
|
43 | 43 | def test_shouting_numbers(self): |
44 | | - self.assertEqual(hey("1, 2, 3 GO!"), "Whoa, chill out!") |
| 44 | + self.assertEqual(response("1, 2, 3 GO!"), "Whoa, chill out!") |
45 | 45 |
|
46 | 46 | def test_no_letters(self): |
47 | | - self.assertEqual(hey("1, 2, 3"), "Whatever.") |
| 47 | + self.assertEqual(response("1, 2, 3"), "Whatever.") |
48 | 48 |
|
49 | 49 | def test_question_with_no_letters(self): |
50 | | - self.assertEqual(hey("4?"), "Sure.") |
| 50 | + self.assertEqual(response("4?"), "Sure.") |
51 | 51 |
|
52 | 52 | def test_shouting_with_special_characters(self): |
53 | 53 | self.assertEqual( |
54 | | - hey("ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!"), |
| 54 | + response("ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!"), |
55 | 55 | "Whoa, chill out!") |
56 | 56 |
|
57 | 57 | def test_shouting_with_no_exclamation_mark(self): |
58 | | - self.assertEqual(hey("I HATE THE DMV"), "Whoa, chill out!") |
| 58 | + self.assertEqual(response("I HATE THE DMV"), "Whoa, chill out!") |
59 | 59 |
|
60 | 60 | def test_statement_containing_question_mark(self): |
61 | 61 | self.assertEqual( |
62 | | - hey("Ending with ? means a question."), "Whatever.") |
| 62 | + response("Ending with ? means a question."), "Whatever.") |
63 | 63 |
|
64 | 64 | def test_non_letters_with_question(self): |
65 | | - self.assertEqual(hey(":) ?"), "Sure.") |
| 65 | + self.assertEqual(response(":) ?"), "Sure.") |
66 | 66 |
|
67 | 67 | def test_prattling_on(self): |
68 | 68 | self.assertEqual( |
69 | | - hey("Wait! Hang on. Are you going to be OK?"), "Sure.") |
| 69 | + response("Wait! Hang on. Are you going to be OK?"), "Sure.") |
70 | 70 |
|
71 | 71 | def test_silence(self): |
72 | | - self.assertEqual(hey(""), "Fine. Be that way!") |
| 72 | + self.assertEqual(response(""), "Fine. Be that way!") |
73 | 73 |
|
74 | 74 | def test_prolonged_silence(self): |
75 | | - self.assertEqual(hey(" "), "Fine. Be that way!") |
| 75 | + self.assertEqual(response(" "), "Fine. Be that way!") |
76 | 76 |
|
77 | 77 | def test_alternate_silence(self): |
78 | | - self.assertEqual(hey("\t\t\t\t\t\t\t\t\t\t"), "Fine. Be that way!") |
| 78 | + self.assertEqual(response("\t\t\t\t\t\t\t\t\t\t"), |
| 79 | + "Fine. Be that way!") |
79 | 80 |
|
80 | 81 | def test_multiple_line_question(self): |
81 | 82 | self.assertEqual( |
82 | | - hey("\nDoes this cryogenic chamber make me look fat?\nNo."), |
83 | | - "Whatever.") |
| 83 | + response("\nDoes this cryogenic chamber make me look fat?\n" |
| 84 | + "No."), "Whatever.") |
84 | 85 |
|
85 | 86 | def test_starting_with_whitespace(self): |
86 | | - self.assertEqual(hey(" hmmmmmmm..."), "Whatever.") |
| 87 | + self.assertEqual(response(" hmmmmmmm..."), "Whatever.") |
87 | 88 |
|
88 | 89 | def test_ending_with_whitespace(self): |
89 | 90 | self.assertEqual( |
90 | | - hey("Okay if like my spacebar quite a bit? "), "Sure.") |
| 91 | + response("Okay if like my spacebar quite a bit? "), "Sure.") |
91 | 92 |
|
92 | 93 | def test_other_whitespace(self): |
93 | | - self.assertEqual(hey("\n\r \t"), "Fine. Be that way!") |
| 94 | + self.assertEqual(response("\n\r \t"), "Fine. Be that way!") |
94 | 95 |
|
95 | 96 | def test_non_question_ending_with_whitespace(self): |
96 | 97 | self.assertEqual( |
97 | | - hey("This is a statement ending with whitespace "), |
| 98 | + response("This is a statement ending with whitespace "), |
98 | 99 | "Whatever.") |
99 | 100 |
|
100 | 101 |
|
|
0 commit comments