Lines Matching refs:self
13 def test_restart_line_wide(self):
14 eq = self.assertEqual
18 with self.subTest(file=file, bar=bar):
24 def test_restart_line_narrow(self):
27 with self.subTest(width=width):
28 self.assertEqual(pyshell.restart_line(width, ''), expect)
29 self.assertEqual(pyshell.restart_line(taglen+2, ''), expect+' =')
48 def test_init(self):
49 psfl = pyshell.PyShellFileList(self.root)
50 self.assertEqual(psfl.EditorWindow, pyshell.PyShellEditorWindow)
51 self.assertIsNone(psfl.pyshell)
57 ## def test_openshell(self):
59 ## ps = pyshell.PyShellFileList(self.root).open_shell()
60 ## self.assertIsInstance(ps, pyshell.PyShell)
66 def all_removed(self, text):
67 self.assertEqual('', self.regexp.sub('', text))
69 def none_removed(self, text):
70 self.assertEqual(text, self.regexp.sub('', text))
72 def check_result(self, text, expected):
73 self.assertEqual(expected, self.regexp.sub('', text))
75 def test_empty(self):
76 self.all_removed('')
78 def test_newline(self):
79 self.all_removed('\n')
81 def test_whitespace_no_newline(self):
82 self.all_removed(' ')
83 self.all_removed(' ')
84 self.all_removed(' ')
85 self.all_removed(' ' * 20)
86 self.all_removed('\t')
87 self.all_removed('\t\t')
88 self.all_removed('\t\t\t')
89 self.all_removed('\t' * 20)
90 self.all_removed('\t ')
91 self.all_removed(' \t')
92 self.all_removed(' \t \t ')
93 self.all_removed('\t \t \t')
95 def test_newline_with_whitespace(self):
96 self.all_removed(' \n')
97 self.all_removed('\t\n')
98 self.all_removed(' \t\n')
99 self.all_removed('\t \n')
100 self.all_removed('\n ')
101 self.all_removed('\n\t')
102 self.all_removed('\n \t')
103 self.all_removed('\n\t ')
104 self.all_removed(' \n ')
105 self.all_removed('\t\n ')
106 self.all_removed(' \n\t')
107 self.all_removed('\t\n\t')
108 self.all_removed('\t \t \t\n')
109 self.all_removed(' \t \t \n')
110 self.all_removed('\n\t \t \t')
111 self.all_removed('\n \t \t ')
113 def test_multiple_newlines(self):
114 self.check_result('\n\n', '\n')
115 self.check_result('\n' * 5, '\n' * 4)
116 self.check_result('\n' * 5 + '\t', '\n' * 4)
117 self.check_result('\n' * 20, '\n' * 19)
118 self.check_result('\n' * 20 + ' ', '\n' * 19)
119 self.check_result(' \n \n ', ' \n')
120 self.check_result(' \n\n ', ' \n')
121 self.check_result(' \n\n', ' \n')
122 self.check_result('\t\n\n', '\t\n')
123 self.check_result('\n\n ', '\n')
124 self.check_result('\n\n\t', '\n')
125 self.check_result(' \n \n ', ' \n')
126 self.check_result('\t\n\t\n\t', '\t\n')
128 def test_non_whitespace(self):
129 self.none_removed('a')
130 self.check_result('a\n', 'a')
131 self.check_result('a\n ', 'a')
132 self.check_result('a \n ', 'a')
133 self.check_result('a \n\t', 'a')
134 self.none_removed('-')
135 self.check_result('-\n', '-')
136 self.none_removed('.')
137 self.check_result('.\n', '.')
139 def test_unsupported_whitespace(self):
140 self.none_removed('\v')
141 self.none_removed('\n\v')
142 self.check_result('\v\n', '\v')
143 self.none_removed(' \n\v')
144 self.check_result('\v\n ', '\v')