-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_response_controller.py
53 lines (41 loc) · 1.71 KB
/
test_response_controller.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from response_controller import generate_cate_response
from unittest import TestCase
from urllib.parse import quote
class TestResponseController(TestCase):
def setUp(self):
pass
def test_generate_cate_response_alphanumeric(self):
query_text = (
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789"
)
expected = (
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789"
)
self.assertEqual(
generate_cate_response(query_text), expected
)
def test_generate_cate_response_symbolic(self):
# / is not okay, thanks apache/Flask
query_text = quote("!@#$%^&*()-=\"';:[]{}\\~`,.<>?", safe='')
expected = "!@#$%^&*()-="';:[]{}\~`,.<>?"
self.assertEqual(
generate_cate_response(query_text), expected
)
def test_cate_response_does_not_cateify_emoji(self):
query_text = "🥕🍆🗑️"
expected = "🥕🍆🗑️"
self.assertEqual(
generate_cate_response(query_text), expected
)
def test_cate_response_does_not_cateify_mixed_out_of_range(self):
query_text = "The 🥕 live outsidé of the code path米?"
expected = "The 🥕 live outsidé of the code path米?"
self.assertEqual(
generate_cate_response(query_text), expected
)
def tearDown(self):
pass