Basic line splitter test with default specs.
()
| 95 | |
| 96 | |
| 97 | def test_line_split(): |
| 98 | """Basic line splitter test with default specs.""" |
| 99 | sp = completer.CompletionSplitter() |
| 100 | # The format of the test specs is: part1, part2, expected answer. Parts 1 |
| 101 | # and 2 are joined into the 'line' sent to the splitter, as if the cursor |
| 102 | # was at the end of part1. So an empty part2 represents someone hitting |
| 103 | # tab at the end of the line, the most common case. |
| 104 | t = [ |
| 105 | ("run some/scrip", "", "some/scrip"), |
| 106 | ("run scripts/er", "ror.py foo", "scripts/er"), |
| 107 | ("echo $HOM", "", "HOM"), |
| 108 | ("print sys.pa", "", "sys.pa"), |
| 109 | ("print(sys.pa", "", "sys.pa"), |
| 110 | ("execfile('scripts/er", "", "scripts/er"), |
| 111 | ("a[x.", "", "x."), |
| 112 | ("a[x.", "y", "x."), |
| 113 | ('cd "some_file/', "", "some_file/"), |
| 114 | ] |
| 115 | check_line_split(sp, t) |
| 116 | # Ensure splitting works OK with unicode by re-running the tests with |
| 117 | # all inputs turned into unicode |
| 118 | check_line_split(sp, [map(str, p) for p in t]) |
| 119 | |
| 120 | |
| 121 | class NamedInstanceMetaclass(type): |
nothing calls this directly
no test coverage detected