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())
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'))
def _build_cell_info(self, content, position): return CellInfo(content, position, for_loop=True)
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())
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())
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())
def test_empty_tooltip(self): cell = CellInfo(CellContent(ContentType.EMPTY, None), CellPosition(CellType.UNKNOWN, None)) assert_false(TipMessage(cell))
def test_for_loop_var(self): cell = CellInfo(CellContent(ContentType.VARIABLE, '${i}'), CellPosition(CellType.MANDATORY, None), for_loop=True) assert_false(TipMessage(cell))
def test_for_loop_start(self): cell = CellInfo(CellContent(ContentType.STRING, ':FOR'), CellPosition(CellType.MANDATORY, None), for_loop=True) assert_false(TipMessage(cell))
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)
def _build_cell_info(self, content, position): return CellInfo(content, position)
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))
def test_unknown_variable(self): cell = CellInfo( CellContent(ContentType.UNKNOWN_VARIABLE, '${unknown}'), CellPosition(CellType.UNKNOWN, None)) assert_true(TipMessage(cell))