예제 #1
0
 def test_skip_next_char_then_whitespaces_with_default_nb_char_to_skip(self):
     """
     Test if the ``skip_next_char_then_whitespaces`` method skip any char at beginning of the string if not specified.
     """
     offset, ch = skip_next_char_then_whitespaces("xy   abcdef", 0)
     self.assertEqual(offset, 1)
     self.assertEqual('y', ch)
예제 #2
0
 def test_skip_next_char_then_whitespaces_without_whitespaces(self):
     """
     Test if the ``skip_next_char_then_whitespaces`` method work with a string starting without whitespaces.
     """
     offset, ch = skip_next_char_then_whitespaces("abcdef", 0)
     self.assertEqual(offset, 1)
     self.assertEqual('b', ch)
예제 #3
0
 def test_skip_next_char_then_whitespaces_with_whitespaces(self):
     """
     Test if the ``skip_next_char_then_whitespaces`` method skip whitespaces at the beginning of the string.
     """
     offset, ch = skip_next_char_then_whitespaces("     abcdef", 0)
     self.assertEqual(offset, 5)
     self.assertEqual('a', ch)
예제 #4
0
 def test_skip_next_char_then_whitespaces_with_offset(self):
     """
     Test if the ``skip_next_char_then_whitespaces`` method skip whitespaces at beginning of the string starting
     at the given offset.
     """
     offset, ch = skip_next_char_then_whitespaces("xy   abcdef", 2)
     self.assertEqual(offset, 5)
     self.assertEqual('a', ch)
예제 #5
0
 def test_skip_next_char_then_whitespaces_with_whitespaces_only(self):
     """
     Test if the ``skip_next_char_then_whitespaces`` method raise a ``IndexError`` if the string end with whitespaces.
     """
     with self.assertRaises(IndexError):
         skip_next_char_then_whitespaces("  ", 0)