Ejemplo n.º 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())
Ejemplo n.º 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'))
Ejemplo n.º 4
0
 def _build_cell_info(self, content, position):
     return CellInfo(content, position, for_loop=True)
Ejemplo n.º 5
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())
Ejemplo n.º 6
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())
Ejemplo n.º 7
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())
Ejemplo n.º 8
0
 def test_empty_tooltip(self):
     cell = CellInfo(CellContent(ContentType.EMPTY, None),
                     CellPosition(CellType.UNKNOWN, None))
     assert_false(TipMessage(cell))
Ejemplo n.º 9
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())
Ejemplo n.º 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))
Ejemplo n.º 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))
Ejemplo n.º 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)
Ejemplo n.º 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())
Ejemplo n.º 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())
Ejemplo n.º 15
0
 def _build_cell_info(self, content, position):
     return CellInfo(content, position)
Ejemplo n.º 16
0
 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))
Ejemplo n.º 17
0
 def test_unknown_variable(self):
     cell = CellInfo(
         CellContent(ContentType.UNKNOWN_VARIABLE, '${unknown}'),
         CellPosition(CellType.UNKNOWN, None))
     assert_true(TipMessage(cell))