Ejemplo n.º 1
0
 def test_next_delim_not_found(self):
     """Should return length of line if delim does not exist"""
     line = '01 34textnospace'
     start_cols = [3, 5, len(line) - 1]
     for col in start_cols:
         pos = TextUtilities.next_delimiter_pos(line, col)
         self.assertEqual(pos, len(line))
Ejemplo n.º 2
0
 def test_next_delim_found(self):
     """Should return length of line if delim does not exist"""
     line = '01 345\t789\na/cd'
     start_col_to_delim: dict = {
         0: 2,
         3: 6,
         4: 6,
         8: 10,
         10:
         10,  # when cursor is on a delimiter, return it as the next delimiter
         12: 12,  # '/'
         13: 15  # 'c' -> end of line
     }
     for start, expected_col in start_col_to_delim.items():
         pos = TextUtilities.next_delimiter_pos(line, start)
         self.assertEqual(
             pos, expected_col,
             'For start {0} with value "{1}" expected {2} actual {3}'.
             format(start, line[start], expected_col, pos))