def test_skip_whitespaces_with_whitespaces_only(self): """ Test if the ``skip_whitespaces`` method raise a ``IndexError`` if the string end with whitespaces. """ with self.assertRaises(IndexError): skip_whitespaces(" ", 0, ' ')
def test_skip_whitespaces_without_spaces(self): """ Test the ``skip_whitespaces`` method without any whitespaces """ offset, ch = skip_whitespaces('abcd ', 0, 'a') self.assertEqual(offset, 0) self.assertEqual('a', ch)
def test_skip_whitespaces_with_whitespaces_only(self): """ Test if the ``skip_whitespaces`` method raise a ``IndexError`` if the string end with whitespaces. """ with self.assertRaises(IndexError): skip_whitespaces(" ", 0)
def test_skip_whitespaces(self): """ Test the ``skip_whitespaces`` method with some whitespaces """ offset, ch = skip_whitespaces(' abcd ', 0, ' ') self.assertEqual(offset, 3) self.assertEqual('a', ch)
def test_skip_whitespaces_without_spaces(self): """ Test the ``skip_whitespaces`` method without any whitespaces """ offset = skip_whitespaces('abcd ', 0) self.assertEqual(offset, 0)