예제 #1
0
 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, ' ')
예제 #2
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)
예제 #3
0
 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)
예제 #4
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)
예제 #5
0
 def test_skip_whitespaces_without_spaces(self):
     """ Test the ``skip_whitespaces`` method without any whitespaces """
     offset = skip_whitespaces('abcd   ', 0)
     self.assertEqual(offset, 0)