Lines Matching refs:self

139     def setUp(self):
140 self.data = [x.split("|")[:-1]
142 self.posix_data = [x.split("|")[:-1]
144 for item in self.data:
146 for item in self.posix_data:
149 def splitTest(self, data, comments):
152 self.assertEqual(l, data[i][1:],
156 def oldSplit(self, s):
166 def testSplitNoneDeprecation(self):
167 with self.assertWarns(DeprecationWarning):
170 def testSplitPosix(self):
172 self.splitTest(self.posix_data, comments=True)
174 def testCompat(self):
176 for i in range(len(self.data)):
177 l = self.oldSplit(self.data[i][0])
178 self.assertEqual(l, self.data[i][1:],
180 (self.data[i][0], l, self.data[i][1:]))
182 def testSyntaxSplitAmpersandAndPipe(self):
196 self.assertEqual(ref, result,
199 def testSyntaxSplitSemicolon(self):
212 self.assertEqual(ref, result,
215 def testSyntaxSplitRedirect(self):
227 self.assertEqual(ref, result,
230 def testSyntaxSplitParen(self):
240 self.assertEqual(ref, result,
243 def testSyntaxSplitCustom(self):
249 self.assertEqual(ref, result, "While splitting '%s' [ws=False]" % ss)
254 self.assertEqual(ref, result, "While splitting '%s' [ws=True]" % ss)
256 def testTokenTypes(self):
274 self.assertEqual(observed, expected)
276 def testPunctuationInWordChars(self):
279 self.assertNotIn('_', s.wordchars)
280 self.assertEqual(list(s), ['a', '_', 'b', '__', 'c'])
282 def testPunctuationWithWhitespaceSplit(self):
287 self.assertEqual(list(s), ['a', '&&', 'b', '|', '|', 'c'])
292 self.assertEqual(list(s), ['a', '&&', 'b', '||', 'c'])
294 def testPunctuationWithPosix(self):
298 self.assertEqual(list(s), ['f', '>', 'abc'])
300 self.assertEqual(list(s), ['f', '>', '"abc"'])
302 def testEmptyStringHandling(self):
309 self.assertEqual(slist, expected)
312 self.assertEqual(list(s), expected)
314 def testUnicodeHandling(self):
321 self.assertEqual(list(s), ref)
325 self.assertEqual(list(s), ref)
327 def testQuote(self):
332 self.assertEqual(shlex.quote(''), "''")
333 self.assertEqual(shlex.quote(safeunquoted), safeunquoted)
334 self.assertEqual(shlex.quote('test file name'), "'test file name'")
336 self.assertEqual(shlex.quote('test%sname' % u),
339 self.assertEqual(shlex.quote("test%s'name'" % u),
342 def testJoin(self):
349 with self.subTest(command=command):
351 self.assertEqual(joined, command)
353 def testJoinRoundtrip(self):
354 all_data = self.data + self.posix_data
356 with self.subTest(command=command):
359 self.assertEqual(split_command, resplit)
361 def testPunctuationCharsReadOnly(self):
364 self.assertEqual(shlex_instance.punctuation_chars, punctuation_chars)
365 with self.assertRaises(AttributeError):