class BaseTestCase(unittest.TestCase):

    def setUp(self):
        debug.setLogger(debug.Debug('all', printer=lambda *x: None))

    def tearDown(self):
        debug.setLogger(None) class Tag(object):
class TagSet(object):
    def __init__(self, tagClass, tagFormat, tagId):
    def __repr__(self):
    def __eq__(self, other):
    def __ne__(self, other):
    def __lt__(self, other):
    def __le__(self, other):
    def __gt__(self, other):
    def __ge__(self, other):
    def __hash__(self):
    def __getitem__(self, idx):
    def __iter__(self):
    def __and__(self, otherTag):
    def __or__(self, otherTag):
    def tagClass(self):
    def tagFormat(self):
    def tagId(self):
    def __init__(self, baseTag=(), *superTags):
    def __repr__(self):
    def __add__(self, superTag):
    def __radd__(self, superTag):
    def __getitem__(self, i):
    def __eq__(self, other):
    def __ne__(self, other):
    def __lt__(self, other):
    def __le__(self, other):
    def __gt__(self, other):
    def __ge__(self, other):
    def __hash__(self):
    def __len__(self):
    def baseTag(self):
    def superTags(self):
    def tagExplicitly(self, superTag):
    def tagImplicitly(self, superTag):
    def isSuperTagSetOf(self, tagSet):
    def getBaseTag(self):
def initTagSet(tag): class NamedType(object):
class OptionalNamedType(NamedType):
class DefaultedNamedType(NamedType):
class NamedTypes(object):
    class PostponedError(object):
    def __init__(self, name, asn1Object, openType=None):
    def __repr__(self):
    def __eq__(self, other):
    def __ne__(self, other):
    def __lt__(self, other):
    def __le__(self, other):
    def __gt__(self, other):
    def __ge__(self, other):
    def __hash__(self):
    def __getitem__(self, idx):
    def __iter__(self):
    def name(self):
    def asn1Object(self):
    def openType(self):
    def getName(self):
    def getType(self):
    def __init__(self, *namedTypes, **kwargs):
    def __repr__(self):
    def __eq__(self, other):
    def __ne__(self, other):
    def __lt__(self, other):
    def __le__(self, other):
    def __gt__(self, other):
    def __ge__(self, other):
    def __hash__(self):
    def __getitem__(self, idx):
    def __contains__(self, key):
    def __iter__(self):
        def __nonzero__(self):
        def __bool__(self):
    def __len__(self):
    def values(self):
    def keys(self):
    def items(self):
    def clone(self):
        def __init__(self, errorMsg):
        def __getitem__(self, item):
    def __computeTagToPosMap(self):
    def __computeNameToPosMap(self):
    def __computeAmbiguousTypes(self):
    def getTypeByPosition(self, idx):
    def getPositionByType(self, tagSet):
    def getNameByPosition(self, idx):
    def getPositionByName(self, name):
    def getTagMapNearPosition(self, idx):
    def getPositionNearType(self, tagSet, idx):
    def __computeMinTagSet(self):
    def minTagSet(self):
    def __computeTagMaps(self, unique):
    def tagMap(self):
    def tagMapUnique(self):
    def hasOptionalOrDefault(self):
    def hasOpenTypes(self):
    def namedTypes(self):
    def requiredComponents(self): class OpenType(object):
    def __init__(self, name, typeMap=None):
    def name(self):
    def values(self):
    def keys(self):
    def items(self):
    def __contains__(self, key):
    def __getitem__(self, key):
    def __iter__(self): class Integer(base.SimpleAsn1Type):
class Boolean(Integer):
class SizedInteger(SizedIntegerBase):
class BitString(base.SimpleAsn1Type):
class OctetString(base.SimpleAsn1Type):
class Null(OctetString):
class ObjectIdentifier(base.SimpleAsn1Type):
class Real(base.SimpleAsn1Type):
class Enumerated(Integer):
class SequenceOfAndSetOfBase(base.ConstructedAsn1Type):
class SequenceOf(SequenceOfAndSetOfBase):
class SetOf(SequenceOfAndSetOfBase):
class SequenceAndSetBase(base.ConstructedAsn1Type):
    class DynamicNames(object):
class Sequence(SequenceAndSetBase):
class Set(SequenceAndSetBase):
class Choice(Set):
class Any(OctetString):
    def __init__(self, value=noValue, **kwargs):
    def __and__(self, value):
    def __rand__(self, value):
    def __or__(self, value):
    def __ror__(self, value):
    def __xor__(self, value):
    def __rxor__(self, value):
    def __lshift__(self, value):
    def __rshift__(self, value):
    def __add__(self, value):
    def __radd__(self, value):
    def __sub__(self, value):
    def __rsub__(self, value):
    def __mul__(self, value):
    def __rmul__(self, value):
    def __mod__(self, value):
    def __rmod__(self, value):
    def __pow__(self, value, modulo=None):
    def __rpow__(self, value):
    def __floordiv__(self, value):
    def __rfloordiv__(self, value):
        def __div__(self, value):
        def __rdiv__(self, value):
        def __truediv__(self, value):
        def __rtruediv__(self, value):
        def __divmod__(self, value):
        def __rdivmod__(self, value):
    def __int__(self):
        def __long__(self):
    def __float__(self):
    def __abs__(self):
    def __index__(self):
    def __pos__(self):
    def __neg__(self):
    def __invert__(self):
    def __round__(self, n=0):
    def __floor__(self):
    def __ceil__(self):
    def __trunc__(self):
    def __lt__(self, value):
    def __le__(self, value):
    def __eq__(self, value):
    def __ne__(self, value):
    def __gt__(self, value):
    def __ge__(self, value):
    def prettyIn(self, value):
    def prettyOut(self, value):
    def getNamedValues(self):
    def setBitLength(self, bitLength):
    def __len__(self):
    def __init__(self, value=noValue, **kwargs):
    def __str__(self):
    def __eq__(self, other):
    def __ne__(self, other):
    def __lt__(self, other):
    def __le__(self, other):
    def __gt__(self, other):
    def __ge__(self, other):
    def __len__(self):
    def __getitem__(self, i):
    def __iter__(self):
    def __reversed__(self):
    def __add__(self, value):
    def __radd__(self, value):
    def __mul__(self, value):
    def __rmul__(self, value):
    def __lshift__(self, count):
    def __rshift__(self, count):
    def __int__(self):
    def __float__(self):
        def __long__(self):
    def asNumbers(self):
    def asOctets(self):
    def asInteger(self):
    def asBinary(self):
    def fromHexString(cls, value, internalFormat=False, prepend=None):
    def fromBinaryString(cls, value, internalFormat=False, prepend=None):
    def fromOctetString(cls, value, internalFormat=False, prepend=None, padding=0):
    def prettyIn(self, value):
    def __init__(self, value=noValue, **kwargs):
        def prettyIn(self, value):
        def __str__(self):
        def __unicode__(self):
        def asOctets(self):
        def asNumbers(self):
        def prettyIn(self, value):
        def __str__(self):
        def __bytes__(self):
        def asOctets(self):
        def asNumbers(self):
    def prettyOut(self, value):
    def prettyPrint(self, scope=0):
    def fromBinaryString(value):
    def fromHexString(value):
    def __len__(self):
    def __getitem__(self, i):
    def __iter__(self):
    def __contains__(self, value):
    def __add__(self, value):
    def __radd__(self, value):
    def __mul__(self, value):
    def __rmul__(self, value):
    def __int__(self):
    def __float__(self):
    def __reversed__(self):
    def prettyIn(self, value):
    def __add__(self, other):
    def __radd__(self, other):
    def asTuple(self):
    def __len__(self):
    def __getitem__(self, i):
    def __iter__(self):
    def __contains__(self, value):
    def index(self, suboid):
    def isPrefixOf(self, other):
    def prettyIn(self, value):
    def prettyOut(self, value):
    def __normalizeBase10(value):
    def prettyIn(self, value):
    def prettyPrint(self, scope=0):
    def isPlusInf(self):
    def isMinusInf(self):
    def isInf(self):
    def __add__(self, value):
    def __radd__(self, value):
    def __mul__(self, value):
    def __rmul__(self, value):
    def __sub__(self, value):
    def __rsub__(self, value):
    def __mod__(self, value):
    def __rmod__(self, value):
    def __pow__(self, value, modulo=None):
    def __rpow__(self, value):
        def __div__(self, value):
        def __rdiv__(self, value):
        def __truediv__(self, value):
        def __rtruediv__(self, value):
        def __divmod__(self, value):
        def __rdivmod__(self, value):
    def __int__(self):
        def __long__(self):
    def __float__(self):
    def __abs__(self):
    def __pos__(self):
    def __neg__(self):
    def __round__(self, n=0):
    def __floor__(self):
    def __ceil__(self):
    def __trunc__(self):
    def __lt__(self, value):
    def __le__(self, value):
    def __eq__(self, value):
    def __ne__(self, value):
    def __gt__(self, value):
    def __ge__(self, value):
        def __nonzero__(self):
        def __bool__(self):
    def __getitem__(self, idx):
    def isPlusInfinity(self):
    def isMinusInfinity(self):
    def isInfinity(self):
    def __init__(self, *args, **kwargs):
    def __getitem__(self, idx):
    def __setitem__(self, idx, value):
    def append(self, value):
    def count(self, value):
    def extend(self, values):
    def index(self, value, start=0, stop=None):
    def reverse(self):
    def sort(self, key=None, reverse=False):
    def __len__(self):
    def __iter__(self):
    def _cloneComponentValues(self, myClone, cloneValueFlag):
    def getComponentByPosition(self, idx, default=noValue, instantiate=True):
    def setComponentByPosition(self, idx, value=noValue,
                               verifyConstraints=True,
                               matchTags=True,
                               matchConstraints=True):
    def componentTagMap(self):
    def components(self):
    def clear(self):
    def reset(self):
    def prettyPrint(self, scope=0):
    def prettyPrintType(self, scope=0):
    def isValue(self):
    def isInconsistent(self):
        def __init__(self):
        def __len__(self):
        def __contains__(self, item):
        def __iter__(self):
        def __getitem__(self, item):
        def getNameByPosition(self, idx):
        def getPositionByName(self, name):
        def addField(self, idx):
    def __init__(self, **kwargs):
    def __getitem__(self, idx):
    def __setitem__(self, idx, value):
    def __contains__(self, key):
    def __len__(self):
    def __iter__(self):
    def values(self):
    def keys(self):
    def items(self):
    def update(self, *iterValue, **mappingValue):
    def clear(self):
    def reset(self):
    def components(self):
    def _cloneComponentValues(self, myClone, cloneValueFlag):
    def getComponentByName(self, name, default=noValue, instantiate=True):
    def setComponentByName(self, name, value=noValue,
                           verifyConstraints=True,
                           matchTags=True,
                           matchConstraints=True):
    def getComponentByPosition(self, idx, default=noValue, instantiate=True):
    def setComponentByPosition(self, idx, value=noValue,
                               verifyConstraints=True,
                               matchTags=True,
                               matchConstraints=True):
    def isValue(self):
    def isInconsistent(self):
    def prettyPrint(self, scope=0):
    def prettyPrintType(self, scope=0):
    def setDefaultComponents(self):
    def getComponentType(self):
    def getNameByPosition(self, idx):
    def getComponentTagMapNearPosition(self, idx):
    def getComponentPositionNearType(self, tagSet, idx):
    def getComponent(self, innerFlag=False):
    def getComponentByType(self, tagSet, default=noValue,
                           instantiate=True, innerFlag=False):
    def setComponentByType(self, tagSet, value=noValue,
                           verifyConstraints=True,
                           matchTags=True,
                           matchConstraints=True,
                           innerFlag=False):
    def componentTagMap(self):
    def __eq__(self, other):
    def __ne__(self, other):
    def __lt__(self, other):
    def __le__(self, other):
    def __gt__(self, other):
    def __ge__(self, other):
        def __nonzero__(self):
        def __bool__(self):
    def __len__(self):
    def __contains__(self, key):
    def __iter__(self):
    def values(self):
    def keys(self):
    def items(self):
    def checkConsistency(self):
    def _cloneComponentValues(self, myClone, cloneValueFlag):
    def getComponentByPosition(self, idx, default=noValue, instantiate=True):
    def setComponentByPosition(self, idx, value=noValue,
                               verifyConstraints=True,
                               matchTags=True,
                               matchConstraints=True):
    def effectiveTagSet(self):
    def tagMap(self):
    def getComponent(self, innerFlag=False):
    def getName(self, innerFlag=False):
    def isValue(self):
    def clear(self):
    def getMinTagSet(self):
    def tagMap(self): class AbstractCharacterString(univ.OctetString):
class NumericString(AbstractCharacterString):
class PrintableString(AbstractCharacterString):
class TeletexString(AbstractCharacterString):
class T61String(TeletexString):
class VideotexString(AbstractCharacterString):
class IA5String(AbstractCharacterString):
class GraphicString(AbstractCharacterString):
class VisibleString(AbstractCharacterString):
class ISO646String(VisibleString):
class GeneralString(AbstractCharacterString):
class UniversalString(AbstractCharacterString):
class BMPString(AbstractCharacterString):
class UTF8String(AbstractCharacterString):
        def __str__(self):
        def __unicode__(self):
        def prettyIn(self, value):
        def asOctets(self, padding=True):
        def asNumbers(self, padding=True):
        def __str__(self):
        def __bytes__(self):
        def prettyIn(self, value):
        def asOctets(self, padding=True):
        def asNumbers(self, padding=True):
    def prettyOut(self, value):
    def prettyPrint(self, scope=0):
    def __reversed__(self): _PY2 = sys.version_info < (3,)
class CachingStreamWrapper(io.IOBase):
    def __init__(self, raw):
    def peek(self, n):
    def seekable(self):
    def seek(self, n=-1, whence=os.SEEK_SET):
    def read(self, n=-1):
    def markedPosition(self):
    def markedPosition(self, value):
    def tell(self):
def asSeekableStream(substrate):
def isEndOfStream(substrate):
def peekIntoStream(substrate, size=-1):
def readFromStream(substrate, size=-1, context=None): LOG = debug.registerLoggee(__name__, flags=debug.DEBUG_DECODER)
TAG_MAP = {
    univ.Integer.tagSet: IntegerPayloadDecoder(),
    univ.Boolean.tagSet: BooleanPayloadDecoder(),
    univ.BitString.tagSet: BitStringPayloadDecoder(),
    univ.OctetString.tagSet: OctetStringPayloadDecoder(),
    univ.Null.tagSet: NullPayloadDecoder(),
    univ.ObjectIdentifier.tagSet: ObjectIdentifierPayloadDecoder(),
    univ.Enumerated.tagSet: IntegerPayloadDecoder(),
    univ.Real.tagSet: RealPayloadDecoder(),
    univ.Sequence.tagSet: SequenceOrSequenceOfPayloadDecoder(),  # conflicts with SequenceOf
    univ.Set.tagSet: SetOrSetOfPayloadDecoder(),  # conflicts with SetOf
    univ.Choice.tagSet: ChoicePayloadDecoder(),  # conflicts with Any
    # character string types
    char.UTF8String.tagSet: UTF8StringPayloadDecoder(),
    char.NumericString.tagSet: NumericStringPayloadDecoder(),
    char.PrintableString.tagSet: PrintableStringPayloadDecoder(),
    char.TeletexString.tagSet: TeletexStringPayloadDecoder(),
    char.VideotexString.tagSet: VideotexStringPayloadDecoder(),
    char.IA5String.tagSet: IA5StringPayloadDecoder(),
    char.GraphicString.tagSet: GraphicStringPayloadDecoder(),
    char.VisibleString.tagSet: VisibleStringPayloadDecoder(),
    char.GeneralString.tagSet: GeneralStringPayloadDecoder(),
    char.UniversalString.tagSet: UniversalStringPayloadDecoder(),
    char.BMPString.tagSet: BMPStringPayloadDecoder(),
    # useful types
    useful.ObjectDescriptor.tagSet: ObjectDescriptorPayloadDecoder(),
    useful.GeneralizedTime.tagSet: GeneralizedTimePayloadDecoder(),
    useful.UTCTime.tagSet: UTCTimePayloadDecoder()
}
TYPE_MAP = {
    univ.Set.typeId: SetPayloadDecoder(),
    univ.SetOf.typeId: SetOfPayloadDecoder(),
    univ.Sequence.typeId: SequencePayloadDecoder(),
    univ.SequenceOf.typeId: SequenceOfPayloadDecoder(),
    univ.Choice.typeId: ChoicePayloadDecoder(),
    univ.Any.typeId: AnyPayloadDecoder()
}
EOO_SENTINEL = ints2octs((0, 0))
    TAG_MAP = TAG_MAP
    TYPE_MAP = TYPE_MAP
    SINGLE_ITEM_DECODER = SingleItemDecoder
    STREAMING_DECODER = StreamingDecoder
class AbstractPayloadDecoder(object):
class AbstractSimplePayloadDecoder(AbstractPayloadDecoder):
class RawPayloadDecoder(AbstractSimplePayloadDecoder):
class IntegerPayloadDecoder(AbstractSimplePayloadDecoder):
class BooleanPayloadDecoder(IntegerPayloadDecoder):
class BitStringPayloadDecoder(AbstractSimplePayloadDecoder):
class OctetStringPayloadDecoder(AbstractSimplePayloadDecoder):
class NullPayloadDecoder(AbstractSimplePayloadDecoder):
class ObjectIdentifierPayloadDecoder(AbstractSimplePayloadDecoder):
class RealPayloadDecoder(AbstractSimplePayloadDecoder):
class AbstractConstructedPayloadDecoder(AbstractPayloadDecoder):
class ConstructedPayloadDecoderBase(AbstractConstructedPayloadDecoder):
class SequenceOrSequenceOfPayloadDecoder(ConstructedPayloadDecoderBase):
class SequencePayloadDecoder(SequenceOrSequenceOfPayloadDecoder):
class SequenceOfPayloadDecoder(SequenceOrSequenceOfPayloadDecoder):
class SetOrSetOfPayloadDecoder(ConstructedPayloadDecoderBase):
class SetPayloadDecoder(SetOrSetOfPayloadDecoder):
class SetOfPayloadDecoder(SetOrSetOfPayloadDecoder):
class ChoicePayloadDecoder(ConstructedPayloadDecoderBase):
class AnyPayloadDecoder(AbstractSimplePayloadDecoder):
class UTF8StringPayloadDecoder(OctetStringPayloadDecoder):
class NumericStringPayloadDecoder(OctetStringPayloadDecoder):
class PrintableStringPayloadDecoder(OctetStringPayloadDecoder):
class TeletexStringPayloadDecoder(OctetStringPayloadDecoder):
class VideotexStringPayloadDecoder(OctetStringPayloadDecoder):
class IA5StringPayloadDecoder(OctetStringPayloadDecoder):
class GraphicStringPayloadDecoder(OctetStringPayloadDecoder):
class VisibleStringPayloadDecoder(OctetStringPayloadDecoder):
class GeneralStringPayloadDecoder(OctetStringPayloadDecoder):
class UniversalStringPayloadDecoder(OctetStringPayloadDecoder):
class BMPStringPayloadDecoder(OctetStringPayloadDecoder):
class ObjectDescriptorPayloadDecoder(OctetStringPayloadDecoder):
class GeneralizedTimePayloadDecoder(OctetStringPayloadDecoder):
class UTCTimePayloadDecoder(OctetStringPayloadDecoder):
class SingleItemDecoder(object):
class StreamingDecoder(object):
class Decoder(object):
    def valueDecoder(self, substrate, asn1Spec,
                     tagSet=None, length=None, state=None,
                     decodeFun=None, substrateFun=None,
                     **options):
    def indefLenValueDecoder(self, substrate, asn1Spec,
                             tagSet=None, length=None, state=None,
                             decodeFun=None, substrateFun=None,
                             **options):
    def _passAsn1Object(asn1Object, options):
    def substrateCollector(asn1Object, substrate, length, options):
    def _createComponent(self, asn1Spec, tagSet, value, **options):
    def valueDecoder(self, substrate, asn1Spec,
                     tagSet=None, length=None, state=None,
                     decodeFun=None, substrateFun=None,
                     **options):
    def indefLenValueDecoder(self, substrate, asn1Spec,
                             tagSet=None, length=None, state=None,
                             decodeFun=None, substrateFun=None,
                             **options):
    def valueDecoder(self, substrate, asn1Spec,
                     tagSet=None, length=None, state=None,
                     decodeFun=None, substrateFun=None,
                     **options):
    def _createComponent(self, asn1Spec, tagSet, value, **options):
    def valueDecoder(self, substrate, asn1Spec,
                     tagSet=None, length=None, state=None,
                     decodeFun=None, substrateFun=None,
                     **options):
    def indefLenValueDecoder(self, substrate, asn1Spec,
                             tagSet=None, length=None, state=None,
                             decodeFun=None, substrateFun=None,
                             **options):
    def valueDecoder(self, substrate, asn1Spec,
                     tagSet=None, length=None, state=None,
                     decodeFun=None, substrateFun=None,
                     **options):
    def indefLenValueDecoder(self, substrate, asn1Spec,
                             tagSet=None, length=None, state=None,
                             decodeFun=None, substrateFun=None,
                             **options):
    def valueDecoder(self, substrate, asn1Spec,
                     tagSet=None, length=None, state=None,
                     decodeFun=None, substrateFun=None,
                     **options):
    def valueDecoder(self, substrate, asn1Spec,
                     tagSet=None, length=None, state=None,
                     decodeFun=None, substrateFun=None,
                     **options):
    def valueDecoder(self, substrate, asn1Spec,
                     tagSet=None, length=None, state=None,
                     decodeFun=None, substrateFun=None,
                     **options):
    def _getComponentTagMap(self, asn1Object, idx):
    def _getComponentPositionByType(self, asn1Object, tagSet, idx):
    def _decodeComponentsSchemaless(
            self, substrate, tagSet=None, decodeFun=None,
            length=None, **options):
    def valueDecoder(self, substrate, asn1Spec,
                     tagSet=None, length=None, state=None,
                     decodeFun=None, substrateFun=None,
                     **options):
    def indefLenValueDecoder(self, substrate, asn1Spec,
                             tagSet=None, length=None, state=None,
                             decodeFun=None, substrateFun=None,
                             **options):
    def valueDecoder(self, substrate, asn1Spec,
                     tagSet=None, length=None, state=None,
                     decodeFun=None, substrateFun=None,
                     **options):
    def indefLenValueDecoder(self, substrate, asn1Spec,
                             tagSet=None, length=None, state=None,
                             decodeFun=None, substrateFun=None,
                             **options):
    def valueDecoder(self, substrate, asn1Spec,
                     tagSet=None, length=None, state=None,
                     decodeFun=None, substrateFun=None,
                     **options):
    def indefLenValueDecoder(self, substrate, asn1Spec,
                             tagSet=None, length=None, state=None,
                             decodeFun=None, substrateFun=None,
                             **options):
    def __init__(self, **options):
    def __call__(self, substrate, asn1Spec=None,
                 tagSet=None, length=None, state=stDecodeTag,
                 decodeFun=None, substrateFun=None,
                 **options):
    def __init__(self, substrate, asn1Spec=None, **options):
    def __iter__(self):
    def __call__(cls, substrate, asn1Spec=None, **options): class EndOfOctets(base.SimpleAsn1Type):
    def __new__(cls, *args, **kwargs): class PyAsn1Error(Exception):
class ValueConstraintError(PyAsn1Error):
class SubstrateUnderrunError(PyAsn1Error):
class EndOfStreamError(SubstrateUnderrunError):
class UnsupportedSubstrateError(PyAsn1Error):
class PyAsn1UnicodeError(PyAsn1Error, UnicodeError):
class PyAsn1UnicodeDecodeError(PyAsn1UnicodeError, UnicodeDecodeError):
class PyAsn1UnicodeEncodeError(PyAsn1UnicodeError, UnicodeEncodeError):
    def __init__(self, *args, **kwargs):
    def context(self):
    def __init__(self, message, unicode_error=None):
import gzip
import io
import os
import sys
import tempfile
import unittest
import zipfile
from tests.base import BaseTestCase
from pyasn1.type import tag
from pyasn1.type import namedtype
from pyasn1.type import opentype
from pyasn1.type import univ
from pyasn1.type import char
from pyasn1.codec import streaming
from pyasn1.codec.ber import decoder
from pyasn1.codec.ber import eoo
from pyasn1.compat.octets import ints2octs, str2octs, null
from pyasn1 import error
        self.s = univ.SetOf(componentType=univ.OctetString())
        self.s.setComponentByPosition(0, univ.OctetString('quick brown'))

    def testDefMode(self):
        assert decoder.decode(
            ints2octs((49, 13, 4, 11, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110))
        ) == (self.s, null)

    def testIndefMode(self):
        assert decoder.decode(
            ints2octs((49, 128, 4, 11, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110, 0, 0))
        ) == (self.s, null)

    def testDefModeChunked(self):
        assert decoder.decode(
            ints2octs((49, 19, 36, 17, 4, 4, 113, 117, 105, 99, 4, 4, 107, 32, 98, 114, 4, 3, 111, 119, 110))
        ) == (self.s, null)

    def testIndefModeChunked(self):
        assert decoder.decode(
            ints2octs((49, 128, 36, 128, 4, 4, 113, 117, 105, 99, 4, 4, 107, 32, 98, 114, 4, 3, 111, 119, 110, 0, 0, 0, 0))
        ) == (self.s, null)

    def testSchemalessDecoder(self):
        assert decoder.decode(
            ints2octs((49, 13, 4, 11, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110)), asn1Spec=univ.SetOf()
        ) == (self.s, null)


class SetOfDecoderWithSchemaTestCase(BaseTestCase):
    def setUp(self):
        BaseTestCase.setUp(self)
        self.s = univ.SetOf(componentType=univ.OctetString())
        self.s.setComponentByPosition(0, univ.OctetString('quick brown'))

    def testDefMode(self):
        assert decoder.decode(
            ints2octs((49, 13, 4, 11, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110)), asn1Spec=self.s
        ) == (self.s, null)

    def testIndefMode(self):
        assert decoder.decode(
            ints2octs((49, 128, 4, 11, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110, 0, 0)), asn1Spec=self.s
        ) == (self.s, null)

    def testDefModeChunked(self):
        assert decoder.decode(
            ints2octs((49, 19, 36, 17, 4, 4, 113, 117, 105, 99, 4, 4, 107, 32, 98, 114, 4, 3, 111, 119, 110)), asn1Spec=self.s
        ) == (self.s, null)

    def testIndefModeChunked(self):
        assert decoder.decode(
            ints2octs((49, 128, 36, 128, 4, 4, 113, 117, 105, 99, 4, 4, 107, 32, 98, 114, 4, 3, 111, 119, 110, 0, 0, 0, 0)), asn1Spec=self.s
        ) == (self.s, null)


class SequenceDecoderTestCase(BaseTestCase):
    def setUp(self):
        BaseTestCase.setUp(self)
        self.s = univ.Sequence(
            componentType=namedtype.NamedTypes(
                namedtype.NamedType('place-holder', univ.Null(null)),
                namedtype.NamedType('first-name', univ.OctetString(null)),
                namedtype.NamedType('age', univ.Integer(33))
            )
        )
        self.s.setComponentByPosition(0, univ.Null(null))
        self.s.setComponentByPosition(1, univ.OctetString('quick brown'))
        self.s.setComponentByPosition(2, univ.Integer(1))

    def testWithOptionalAndDefaultedDefMode(self):
        assert decoder.decode(
            ints2octs((48, 18, 5, 0, 4, 11, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110, 2, 1, 1))
        ) == (self.s, null)

    def testWithOptionalAndDefaultedIndefMode(self):
        assert decoder.decode(
            ints2octs((48, 128, 5, 0, 36, 128, 4, 11, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110, 0, 0, 2, 1, 1, 0, 0))
        ) == (self.s, null)

    def testWithOptionalAndDefaultedDefModeChunked(self):
        assert decoder.decode(
            ints2octs(
                (48, 24, 5, 0, 36, 17, 4, 4, 113, 117, 105, 99, 4, 4, 107, 32, 98, 114, 4, 3, 111, 119, 110, 2, 1, 1))
        ) == (self.s, null)

    def testWithOptionalAndDefaultedIndefModeChunked(self):
        assert decoder.decode(
            ints2octs((48, 128, 5, 0, 36, 128, 4, 4, 113, 117, 105, 99, 4, 4, 107, 32, 98, 114, 4, 3, 111, 119, 110, 0, 0, 2, 1, 1, 0, 0))
        ) == (self.s, null)

    def testWithOptionalAndDefaultedDefModeSubst(self):
        assert decoder.decode(
            ints2octs((48, 18, 5, 0, 4, 11, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110, 2, 1, 1)),
            substrateFun=lambda a, b, c, d: streaming.readFromStream(b, c)
        ) == (ints2octs((5, 0, 4, 11, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110, 2, 1, 1)), str2octs(''))

    def testWithOptionalAndDefaultedIndefModeSubst(self):
        assert decoder.decode(
            ints2octs((48, 128, 5, 0, 36, 128, 4, 11, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110, 0, 0, 2, 1, 1, 0, 0)),
            substrateFun=lambda a, b, c, d: streaming.readFromStream(b, c)
        ) == (ints2octs(
            (5, 0, 36, 128, 4, 11, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110, 0, 0, 2, 1, 1, 0, 0)), str2octs(''))

    def testTagFormat(self):
        try:
            decoder.decode(
                ints2octs((16, 18, 5, 0, 4, 11, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110, 2, 1, 1))
            )
        except error.PyAsn1Error:
            pass
        else:
            assert 0, 'wrong tagFormat worked out'


class SequenceDecoderWithSchemaTestCase(BaseTestCase):
    def setUp(self):
        BaseTestCase.setUp(self)
        self.s = univ.Sequence(
            componentType=namedtype.NamedTypes(

                namedtype.NamedType('place-holder', univ.Null(null)),