Пример #1
0
 def test_optional_has_no_error(self):
     assert_false(
         CellInfo(CellContent(ContentType.EMPTY, '', ''),
                  CellPosition(CellType.OPTIONAL, None)).has_error())
     assert_false(
         CellInfo(CellContent(ContentType.STRING, '', ''),
                  CellPosition(CellType.OPTIONAL, None)).has_error())
Пример #2
0
 def test_for_loop_too_many_args(self):
     cell = CellInfo(CellContent(ContentType.STRING, 'something'),
                     CellPosition(CellType.MUST_BE_EMPTY, None),
                     for_loop=True)
     msg = TipMessage(cell)
     assert_true(msg)
     assert_equals(str(msg), _ForLoopTooltipMessage.TOO_MANY_ARGUMENTS)
 def test_known_keyword(self):
     cell = CellInfo(CellContent(ContentType.USER_KEYWORD, 'Known', 'my_source'),
                     CellPosition(CellType.KEYWORD, None))
     msg = TipMessage(cell)
     assert_true(msg)
     assert_equal(str(msg),
                   html_escape(_TooltipMessage.KEYWORD % 'my_source'))
Пример #4
0
 def _get_content_with_type(self, col, position):
     value = self.get_value(col)
     if self._is_commented(col):
         return CellContent(ContentType.COMMENTED, value)
     if self._get_last_none_empty_col_idx() < col:
         return CellContent(ContentType.EMPTY, value)
     if utils.is_variable(value):
         if self._is_unknow_variable(value, position):
             return CellContent(ContentType.UNKNOWN_VARIABLE, value)
         return CellContent(ContentType.VARIABLE, value)
     if self.is_user_keyword(value):
         return CellContent(ContentType.USER_KEYWORD, value, self.get_keyword_info(value).source)
     if self.is_library_keyword(value):
         return CellContent(ContentType.LIBRARY_KEYWORD, value, self.get_keyword_info(value).source)
     return CellContent(ContentType.STRING, value)
Пример #5
0
 def _get_content_with_type(self, col, position):
     value = self.get_value(col)
     if self._is_commented(col):
         return CellContent(ContentType.COMMENTED, value)
     last_none_empty = self._get_last_none_empty_col_idx()
     if isinstance(last_none_empty, int) and last_none_empty < col:
         return CellContent(ContentType.EMPTY, value)
     if variablematcher.is_variable(value):
         if self._is_unknow_variable(value, position):
             return CellContent(ContentType.UNKNOWN_VARIABLE, value)
         return CellContent(ContentType.VARIABLE, value)
     if self.is_user_keyword(value):
         return CellContent(ContentType.USER_KEYWORD, value,
                            self.get_keyword_info(value).source)
     if self.is_library_keyword(value):
         return CellContent(ContentType.LIBRARY_KEYWORD, value,
                            self.get_keyword_info(value).source)
     if col == 0 and value == 'END':
         return CellContent(ContentType.END, value)
     return CellContent(ContentType.STRING, value)
 def get_cell_info(self, row, column):
     return CellInfo(
         CellContent(self._get(self.content_types), self._get_data(), None),
         CellPosition(self._get(self.cell_types), None))
Пример #7
0
 def _get_content_with_type(self, col, position):
     if col == 0:
         return CellContent(ContentType.EMPTY, None)
     return StepController._get_content_with_type(self, col, position)
Пример #8
0
 def test_empty_tooltip(self):
     cell = CellInfo(CellContent(ContentType.EMPTY, None),
                     CellPosition(CellType.UNKNOWN, None))
     assert_false(TipMessage(cell))
Пример #9
0
 def test_unknown_variable(self):
     cell = CellInfo(
         CellContent(ContentType.UNKNOWN_VARIABLE, '${unknown}'),
         CellPosition(CellType.UNKNOWN, None))
     assert_true(TipMessage(cell))
Пример #10
0
 def test_for_loop_var(self):
     cell = CellInfo(CellContent(ContentType.VARIABLE, '${i}'),
                     CellPosition(CellType.MANDATORY, None),
                     for_loop=True)
     assert_false(TipMessage(cell))
Пример #11
0
 def test_for_loop_start(self):
     cell = CellInfo(CellContent(ContentType.STRING, ':FOR'),
                     CellPosition(CellType.MANDATORY, None),
                     for_loop=True)
     assert_false(TipMessage(cell))
Пример #12
0
 def test_unknown_keyword(self):
     cell = CellInfo(CellContent(ContentType.STRING, 'What?'),
                     CellPosition(CellType.KEYWORD, None))
     msg = TipMessage(cell)
     assert_true(msg)
     assert_equals(str(msg), _TooltipMessage.KEYWORD_NOT_FOUND)
Пример #13
0
 def test_empty_mandatory_empty_is_not_error(self):
     cell = CellInfo(CellContent(ContentType.EMPTY, '', ''),
                     CellPosition(CellType.MUST_BE_EMPTY, None))
     assert_false(cell.has_error())
     assert_false(cell.too_many_arguments())
Пример #14
0
 def test_commented_mandatory_is_error(self):
     cell = CellInfo(CellContent(ContentType.COMMENTED, '', ''),
                     CellPosition(CellType.MANDATORY, None))
     assert_true(cell.has_error())
     assert_true(cell.argument_missing())
Пример #15
0
 def test_none_empty_mandatory_is_not_error(self):
     cell = CellInfo(CellContent(ContentType.LIBRARY_KEYWORD, '', ''),
                     CellPosition(CellType.MANDATORY, None))
     assert_false(cell.has_error())
     assert_false(cell.argument_missing())