def test_spaces(self): """Test with only spaces as split chars.""" sp = completer.CompletionSplitter() sp.delims = " " t = [("foo", "", "foo"), ("run foo", "", "foo"), ("run foo", "bar", "foo")] check_line_split(sp, t)
def test_line_split(): """Basic line splitter test with default specs.""" sp = completer.CompletionSplitter() # The format of the test specs is: part1, part2, expected answer. Parts 1 # and 2 are joined into the 'line' sent to the splitter, as if the cursor # was at the end of part1. So an empty part2 represents someone hitting # tab at the end of the line, the most common case. t = [('run some/scrip', '', 'some/scrip'), ('run scripts/er', 'ror.py foo', 'scripts/er'), ('echo $HOM', '', 'HOM'), ('print sys.pa', '', 'sys.pa'), ('print(sys.pa', '', 'sys.pa'), ("execfile('scripts/er", '', 'scripts/er'), ('a[x.', '', 'x.'), ('a[x.', 'y', 'x.'), ('cd "some_file/', '', 'some_file/'), ] check_line_split(sp, t) # Ensure splitting works OK with unicode by re-running the tests with # all inputs turned into unicode check_line_split(sp, [ map(unicode_type, p) for p in t] )
def test_line_split(): """Basic line splitter test with default specs.""" sp = completer.CompletionSplitter() # The format of the test specs is: part1, part2, expected answer. Parts 1 # and 2 are joined into the 'line' sent to the splitter, as if the cursor # was at the end of part1. So an empty part2 represents someone hitting # tab at the end of the line, the most common case. t = [ ("run some/scrip", "", "some/scrip"), ("run scripts/er", "ror.py foo", "scripts/er"), ("echo $HOM", "", "HOM"), ("print sys.pa", "", "sys.pa"), ("print(sys.pa", "", "sys.pa"), ("execfile('scripts/er", "", "scripts/er"), ("a[x.", "", "x."), ("a[x.", "y", "x."), ('cd "some_file/', "", "some_file/"), ] check_line_split(sp, t) # Ensure splitting works OK with unicode by re-running the tests with # all inputs turned into unicode check_line_split(sp, [map(str, p) for p in t])
def setUp(self): self.sp = completer.CompletionSplitter()
def test_delim_setting(self): sp = completer.CompletionSplitter() sp.delims = " " self.assertEqual(sp.delims, " ") self.assertEqual(sp._delim_expr, r"[\ ]")