-
Notifications
You must be signed in to change notification settings - Fork 1
/
join_lines_test.py
89 lines (60 loc) · 3.2 KB
/
join_lines_test.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import unittest
try: # suppress import exception when loading package to sublime
from join_lines import join
except ImportError:
pass
class JoinStringTest(unittest.TestCase):
def test_join_without_new_line_is_text(self):
self.assertEqual(('NONE', 0), join('NONE'))
def test_join_is_joined_string(self):
self.assertEqual(('ONE TWO', 0), join('ONE\nTWO'))
def test_join_is_joined_string_without_spaces(self):
self.assertEqual(('ONE TWO', 0), join('ONE\n TWO'))
def test_join_is_joined_with_spaces(self):
self.assertEqual(('ONE TWO', 0), join('ONE \n TWO'))
def test_join_is_joined_with_prepending_dot(self):
self.assertEqual(('ONE.TWO', 0), join('ONE\n .TWO'))
def test_join_is_joined_with_prepending_closing_bracket(self):
self.assertEqual(('ONE) TWO', 0), join('ONE\n) TWO'))
def test_join_is_joined_with_prepending_closing_bracket_2(self):
self.assertEqual(('ONE] TWO', 0), join('ONE\n] TWO'))
def test_join_is_joined_with_prepending_closing_bracket_3(self):
self.assertEqual(('ONE} TWO', 0), join('ONE\n} TWO'))
def test_join_is_joined_with_prepending_closing_quote(self):
self.assertEqual(('ONE"', 0), join('ONE\n "'))
def test_join_is_joined_with_prepending_double_colon(self):
self.assertEqual(('ONE::TWO', 0), join('ONE::\n TWO'))
def test_join_is_joined_with_appending_dot(self):
self.assertEqual(('ONE.TWO', 0), join('ONE.\n TWO'))
def test_join_is_joined_with_appending_bracket(self):
self.assertEqual(('ONE(TWO', 0), join('ONE(\n TWO'))
def test_join_is_joined_with_appending_bracket_2(self):
self.assertEqual(('ONE[TWO', 0), join('ONE[\n TWO'))
def test_join_is_joined_with_appending_bracket_3(self):
self.assertEqual(('ONE{TWO', 0), join('ONE{\n TWO'))
def test_join_is_joined_with_appending_quote(self):
self.assertEqual(('ONE"TWO', 0), join('ONE"\n TWO'))
def test_join_is_joined_with_following_minus_greater(self):
self.assertEqual(('ONE->TWO', 0), join('ONE\n ->TWO'))
def test_join_is_joined_with_following_double_colon(self):
self.assertEqual(('ONE::TWO', 0), join('ONE\n ::TWO'))
def test_join_is_joined_with_preceding_minus_greater(self):
self.assertEqual(('ONE->TWO', 0), join('ONE->\n TWO'))
def test_join_is_joined_with_preceding_comma(self):
self.assertEqual(('ONE, TWO', 0), join('ONE,\n TWO'))
def test_join_is_joined_with_preceding_comma_with_quote(self):
self.assertEqual(('ONE, "TWO', 0), join('ONE,\n "TWO'))
def test_join_is_joined_with_following_comma(self):
self.assertEqual(('ONE, TWO', 0), join('ONE\n, TWO'))
def test_join_is_joined_with_following_comma_and_brace(self):
self.assertEqual(('ONE}', -1), join('ONE,\n }'))
def test_join_is_joined_with_following_comma_and_bracket(self):
self.assertEqual(('ONE]', -1), join('ONE,\n ]'))
def test_join_is_joined_with_following_comma_and_parenthesis(self):
self.assertEqual(('ONE)', -1), join('ONE,\n )'))
def test_join_is_joined_with_following_quotes_and_plus(self):
self.assertEqual(('"ONE TWO"', -3), join('"ONE" +\n "TWO"'))
def test_join_is_joined_with_following_quotes_and_plus(self):
self.assertEqual(('\'ONE TWO\'', -3), join('\'ONE\' +\n \'TWO\''))
if __name__ == '__main__':
unittest.main()