def test_MID_with_too_large_text(self): self.assertIsInstance( text.MID('foo'+' '*xl.CELL_CHARACTER_LIMIT, 1, 3), xlerrors.ValueExcelError)
def test_MID_num_chars_must_be_positive(self): self.assertIsInstance( text.MID('Romain', 1, -1), xlerrors.NumExcelError)
def test_MID_start_num_must_be_superior_or_equal_to_1(self): self.assertIsInstance( text.MID('Romain', 0, 3), xlerrors.NumExcelError)
def test_MID_num_chars_converted_to_integer(self): self.assertEqual(text.MID('Romain', 1, 2.1), 'Ro')
def test_MID_start_num_converted_to_integer(self): self.assertEqual(text.MID('Romain', 1.1, 2), 'Ro')
def test_MID(self): self.assertEqual(text.MID('Romain', 3, 4), 'main') self.assertEqual(text.MID('Romain', 1, 2), 'Ro') self.assertEqual(text.MID('Romain', 3, 6), 'main')