|
|
|
@ -65,8 +65,8 @@ class ParserTestCase(unittest.TestCase):
|
|
|
|
|
e = list(token_generator(''))
|
|
|
|
|
self.assertEqual(len(e), 2)
|
|
|
|
|
self.assertEqual(e[0].prev, None)
|
|
|
|
|
self.assertTrue(isinstance(e[0].curr, yaml.Token))
|
|
|
|
|
self.assertTrue(isinstance(e[0].next, yaml.Token))
|
|
|
|
|
self.assertIsInstance(e[0].curr, yaml.Token)
|
|
|
|
|
self.assertIsInstance(e[0].next, yaml.Token)
|
|
|
|
|
self.assertEqual(e[1].prev, e[0].curr)
|
|
|
|
|
self.assertEqual(e[1].curr, e[0].next)
|
|
|
|
|
self.assertEqual(e[1].next, None)
|
|
|
|
@ -74,20 +74,20 @@ class ParserTestCase(unittest.TestCase):
|
|
|
|
|
e = list(token_generator('---\n'
|
|
|
|
|
'k: v\n'))
|
|
|
|
|
self.assertEqual(len(e), 9)
|
|
|
|
|
self.assertTrue(isinstance(e[3].curr, yaml.KeyToken))
|
|
|
|
|
self.assertTrue(isinstance(e[5].curr, yaml.ValueToken))
|
|
|
|
|
self.assertIsInstance(e[3].curr, yaml.KeyToken)
|
|
|
|
|
self.assertIsInstance(e[5].curr, yaml.ValueToken)
|
|
|
|
|
|
|
|
|
|
def test_token_or_line_generator(self):
|
|
|
|
|
e = list(token_or_line_generator('---\n'
|
|
|
|
|
'k: v\n'))
|
|
|
|
|
self.assertEqual(len(e), 12)
|
|
|
|
|
self.assertTrue(isinstance(e[0], Token))
|
|
|
|
|
self.assertTrue(isinstance(e[0].curr, yaml.StreamStartToken))
|
|
|
|
|
self.assertTrue(isinstance(e[1], Token))
|
|
|
|
|
self.assertTrue(isinstance(e[1].curr, yaml.DocumentStartToken))
|
|
|
|
|
self.assertTrue(isinstance(e[2], Line))
|
|
|
|
|
self.assertTrue(isinstance(e[3].curr, yaml.BlockMappingStartToken))
|
|
|
|
|
self.assertTrue(isinstance(e[4].curr, yaml.KeyToken))
|
|
|
|
|
self.assertTrue(isinstance(e[6].curr, yaml.ValueToken))
|
|
|
|
|
self.assertTrue(isinstance(e[8], Line))
|
|
|
|
|
self.assertTrue(isinstance(e[11], Line))
|
|
|
|
|
self.assertIsInstance(e[0], Token)
|
|
|
|
|
self.assertIsInstance(e[0].curr, yaml.StreamStartToken)
|
|
|
|
|
self.assertIsInstance(e[1], Token)
|
|
|
|
|
self.assertIsInstance(e[1].curr, yaml.DocumentStartToken)
|
|
|
|
|
self.assertIsInstance(e[2], Line)
|
|
|
|
|
self.assertIsInstance(e[3].curr, yaml.BlockMappingStartToken)
|
|
|
|
|
self.assertIsInstance(e[4].curr, yaml.KeyToken)
|
|
|
|
|
self.assertIsInstance(e[6].curr, yaml.ValueToken)
|
|
|
|
|
self.assertIsInstance(e[8], Line)
|
|
|
|
|
self.assertIsInstance(e[11], Line)
|
|
|
|
|