コード例 #1
0
ファイル: tests_parser.py プロジェクト: TamiaLab/PySkCode
 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
ファイル: tests_parser.py プロジェクト: TamiaLab/PySkCode
 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
ファイル: tests_parser.py プロジェクト: TamiaLab/PySkCode
 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)