-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
22 lines (19 loc) · 814 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import unittest
from services.clip import add_quote_character_escape
class TestStringMethods(unittest.TestCase):
def test_add_quote_character_escape(self):
a = '"I have often wondered," he said'
b = "'I have often wondered,' he said"
c = "This is a simple quote"
d = '"Don\'t reuse routines in derived classes."'
self.assertEqual(
add_quote_character_escape(a), '\\"I have often wondered,\\" he said'
)
self.assertEqual(
add_quote_character_escape(b), "\\'I have often wondered,\\' he said"
)
self.assertEqual(add_quote_character_escape(c), "This is a simple quote")
self.assertEqual(
add_quote_character_escape(d),
'\\"Don\\\'t reuse routines in derived classes.\\"',
)