def test_read_tlv_stream_tests1(self):
    lnser = LNSerializer()
    for tlv_stream_name in ('n1', 'n2'):
        with self.subTest(tlv_stream_name=tlv_stream_name):
            with self.assertRaises(UnexpectedEndOfStream):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(UnexpectedEndOfStream):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd01')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(FieldEncodingNotMinimal):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd000100')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(UnexpectedEndOfStream):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd0101')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(UnexpectedEndOfStream):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('0ffd')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(UnexpectedEndOfStream):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('0ffd26')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(UnexpectedEndOfStream):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('0ffd2602')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(FieldEncodingNotMinimal):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('0ffd000100')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(UnexpectedEndOfStream):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('0ffd0201000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000')), tlv_stream_name='n1')
            with self.assertRaises(UnknownMandatoryTLVRecordType):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('1200')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(UnknownMandatoryTLVRecordType):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd010200')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(UnknownMandatoryTLVRecordType):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('fe0100000200')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(UnknownMandatoryTLVRecordType):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('ff010000000000000200')), tlv_stream_name=tlv_stream_name)
    with self.assertRaises(MsgTrailingGarbage):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('0109ffffffffffffffffff')), tlv_stream_name='n1')
    with self.assertRaises(FieldEncodingNotMinimal):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('010100')), tlv_stream_name='n1')
    with self.assertRaises(FieldEncodingNotMinimal):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('01020001')), tlv_stream_name='n1')
    with self.assertRaises(FieldEncodingNotMinimal):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('0103000100')), tlv_stream_name='n1')
    with self.assertRaises(FieldEncodingNotMinimal):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('010400010000')), tlv_stream_name='n1')
    with self.assertRaises(FieldEncodingNotMinimal):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('01050001000000')), tlv_stream_name='n1')
    with self.assertRaises(FieldEncodingNotMinimal):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('0106000100000000')), tlv_stream_name='n1')
    with self.assertRaises(FieldEncodingNotMinimal):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('010700010000000000')), tlv_stream_name='n1')
    with self.assertRaises(FieldEncodingNotMinimal):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('01080001000000000000')), tlv_stream_name='n1')
    with self.assertRaises(UnexpectedEndOfStream):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('020701010101010101')), tlv_stream_name='n1')
    with self.assertRaises(MsgTrailingGarbage):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('0209010101010101010101')), tlv_stream_name='n1')
    with self.assertRaises(UnexpectedEndOfStream):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('0321023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb')), tlv_stream_name='n1')
    with self.assertRaises(UnexpectedEndOfStream):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('0329023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb0000000000000001')), tlv_stream_name='n1')
    with self.assertRaises(UnexpectedEndOfStream):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('0330023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb000000000000000100000000000001')), tlv_stream_name='n1')
    with self.assertRaises(MsgTrailingGarbage):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('0332023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb0000000000000001000000000000000001')), tlv_stream_name='n1')
    with self.assertRaises(UnexpectedEndOfStream):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd00fe00')), tlv_stream_name='n1')
    with self.assertRaises(UnexpectedEndOfStream):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd00fe0101')), tlv_stream_name='n1')
    with self.assertRaises(MsgTrailingGarbage):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd00fe03010101')), tlv_stream_name='n1')
    with self.assertRaises(UnknownMandatoryTLVRecordType):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('0000')), tlv_stream_name='n1')
def test_read_tlv_stream_tests1(self):
    lnser = LNSerializer()
    for tlv_stream_name in ('n1', 'n2'):
        with self.subTest(tlv_stream_name=tlv_stream_name):
            with self.assertRaises(UnexpectedEndOfStream):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(UnexpectedEndOfStream):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd01')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(FieldEncodingNotMinimal):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd000100')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(UnexpectedEndOfStream):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd0101')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(UnexpectedEndOfStream):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('0ffd')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(UnexpectedEndOfStream):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('0ffd26')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(UnexpectedEndOfStream):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('0ffd2602')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(FieldEncodingNotMinimal):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('0ffd000100')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(UnexpectedEndOfStream):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('0ffd0201000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000')), tlv_stream_name='n1')
            with self.assertRaises(UnknownMandatoryTLVRecordType):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('1200')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(UnknownMandatoryTLVRecordType):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd010200')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(UnknownMandatoryTLVRecordType):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('fe0100000200')), tlv_stream_name=tlv_stream_name)
            with self.assertRaises(UnknownMandatoryTLVRecordType):
                lnser.read_tlv_stream(fd=io.BytesIO(bfh('ff010000000000000200')), tlv_stream_name=tlv_stream_name)
    with self.assertRaises(MsgTrailingGarbage):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('0109ffffffffffffffffff')), tlv_stream_name='n1')
    with self.assertRaises(FieldEncodingNotMinimal):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('010100')), tlv_stream_name='n1')
    with self.assertRaises(FieldEncodingNotMinimal):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('01020001')), tlv_stream_name='n1')
    with self.assertRaises(FieldEncodingNotMinimal):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('0103000100')), tlv_stream_name='n1')
    with self.assertRaises(FieldEncodingNotMinimal):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('010400010000')), tlv_stream_name='n1')
    with self.assertRaises(FieldEncodingNotMinimal):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('01050001000000')), tlv_stream_name='n1')
    with self.assertRaises(FieldEncodingNotMinimal):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('0106000100000000')), tlv_stream_name='n1')
    with self.assertRaises(FieldEncodingNotMinimal):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('010700010000000000')), tlv_stream_name='n1')
    with self.assertRaises(FieldEncodingNotMinimal):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('01080001000000000000')), tlv_stream_name='n1')
    with self.assertRaises(UnexpectedEndOfStream):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('020701010101010101')), tlv_stream_name='n1')
    with self.assertRaises(MsgTrailingGarbage):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('0209010101010101010101')), tlv_stream_name='n1')
    with self.assertRaises(UnexpectedEndOfStream):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('0321023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb')), tlv_stream_name='n1')
    with self.assertRaises(UnexpectedEndOfStream):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('0329023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb0000000000000001')), tlv_stream_name='n1')
    with self.assertRaises(UnexpectedEndOfStream):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('0330023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb000000000000000100000000000001')), tlv_stream_name='n1')
    with self.assertRaises(MsgTrailingGarbage):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('0332023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb0000000000000001000000000000000001')), tlv_stream_name='n1')
    with self.assertRaises(UnexpectedEndOfStream):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd00fe00')), tlv_stream_name='n1')
    with self.assertRaises(UnexpectedEndOfStream):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd00fe0101')), tlv_stream_name='n1')
    with self.assertRaises(MsgTrailingGarbage):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd00fe03010101')), tlv_stream_name='n1')
    with self.assertRaises(UnknownMandatoryTLVRecordType):
        lnser.read_tlv_stream(fd=io.BytesIO(bfh('0000')), tlv_stream_name='n1')