# Path: asn1crypto/parser.py
# _PY2 = sys.version_info <= (3,)
# _INSUFFICIENT_DATA_MESSAGE = 'Insufficient data - %s bytes requested but only %s available'
# _MAX_DEPTH = 10
# def emit(class_, method, tag, contents):
# def parse(contents, strict=False):
# def peek(contents):
# def _parse(encoded_data, data_len, pointer=0, lengths_only=False, depth=0):
# def _dump_header(class_, method, tag, contents):


import unittest
from asn1crypto import parser
from ._unittest_compat import patch
        self.assertEqual(1, result[1])
        self.assertEqual(73, result[2])
        self.assertEqual(b'\x7f\x49\x00', result[3])
        self.assertEqual(b'', result[4])
        self.assertEqual(b'', result[5])

        # Two extra bytes
        result = parser.parse(b'\x7f\x81\x49\x00')
        self.assertEqual(1, result[0])
        self.assertEqual(1, result[1])
        self.assertEqual(201, result[2])
        self.assertEqual(b'\x7f\x81\x49\x00', result[3])
        self.assertEqual(b'', result[4])
        self.assertEqual(b'', result[5])

        # Three extra bytes
        result = parser.parse(b'\x7f\x81\x80\x00\x00')
        self.assertEqual(1, result[0])
        self.assertEqual(1, result[1])
        self.assertEqual(16384, result[2])
        self.assertEqual(b'\x7f\x81\x80\x00\x00', result[3])
        self.assertEqual(b'', result[4])
        self.assertEqual(b'', result[5])

    def test_parser_insufficient_data(self):
        # No tag
        with self.assertRaises(ValueError):
            parser.parse(b'')

        # Long-form tag is truncated

# Path: asn1crypto/parser.py
# _PY2 = sys.version_info <= (3,)
# _INSUFFICIENT_DATA_MESSAGE = 'Insufficient data - %s bytes requested but only %s available'
# _MAX_DEPTH = 10
# def emit(class_, method, tag, contents):
# def parse(contents, strict=False):
# def peek(contents):
# def _parse(encoded_data, data_len, pointer=0, lengths_only=False, depth=0):
# def _dump_header(class_, method, tag, contents):


# Path: tests/test_parser.py
import unittest
from asn1crypto import parser
from ._unittest_compat import patch

        self.assertEqual(1, result[1])
        self.assertEqual(73, result[2])
        self.assertEqual(b'\x7f\x49\x00', result[3])
        self.assertEqual(b'', result[4])
        self.assertEqual(b'', result[5])

        # Two extra bytes
        result = parser.parse(b'\x7f\x81\x49\x00')
        self.assertEqual(1, result[0])
        self.assertEqual(1, result[1])
        self.assertEqual(201, result[2])
        self.assertEqual(b'\x7f\x81\x49\x00', result[3])
        self.assertEqual(b'', result[4])
        self.assertEqual(b'', result[5])

        # Three extra bytes
        result = parser.parse(b'\x7f\x81\x80\x00\x00')
        self.assertEqual(1, result[0])
        self.assertEqual(1, result[1])
        self.assertEqual(16384, result[2])
        self.assertEqual(b'\x7f\x81\x80\x00\x00', result[3])
        self.assertEqual(b'', result[4])
        self.assertEqual(b'', result[5])

    def test_parser_insufficient_data(self):
        # No tag
        with self.assertRaises(ValueError):
            parser.parse(b'')

        # Long-form tag is truncated

        with self.assertRaises(ValueError):