# Path: kraken/lib/codec.py
# class PytorchCodec(object):
#     def __init__(self, charset: Union[Dict[str, Sequence[int]], Sequence[str], str], strict=False):
#     def __len__(self) -> int:
#     def is_valid(self) -> bool:
#     def max_label(self) -> int:
#     def encode(self, s: str) -> IntTensor:
#     def decode(self, labels: Sequence[Tuple[int, int, int, float]]) -> List[Tuple[str, int, int, float]]:
#     def merge(self, codec: 'PytorchCodec') -> Tuple['PytorchCodec', Set]:
#     def add_labels(self, charset: Union[Dict[str, Sequence[int]], Sequence[str], str]) -> 'PytorchCodec':
#     def __repr__(self):
# 
# Path: kraken/lib/exceptions.py
# class KrakenEncodeException(Exception):
# 
#     def __init__(self, message=None):
#         Exception.__init__(self, message)
# 
# class KrakenCodecException(Exception):
# 
#     def __init__(self, message=None):
#         Exception.__init__(self, message)


import unittest
from pytest import raises
from torch import IntTensor
from kraken.lib import codec
from kraken.lib.exceptions import KrakenEncodeException, KrakenCodecException
        Test correct handling of undecodable sequences (many-to-one decoder) in strict mode
        """
        with raises(KrakenEncodeException):
            self.m2o_codec_strict.decode(self.invalid_l_sequence)

    def test_o2m_decode_invalid(self):
        """
        Test correct handling of undecodable sequences (one-to-many decoder) in strict mode
        """
        with raises(KrakenEncodeException):
            self.o2m_codec_strict.decode(self.invalid_l_sequence)

    def test_m2m_decode_invalid(self):
        """
        Test correct handling of undecodable sequences (many-to-many decoder) in strict mode
        """
        with raises(KrakenEncodeException):
            self.m2m_codec_strict.decode(self.invalid_l_sequence)

    def test_o2o_encode_invalid(self):
        """
        Test correct handling of unencodable sequences (one-to-one encoder) in strict mode
        """
        with raises(KrakenEncodeException):
            self.o2o_codec_strict.encode(self.invalid_c_sequence)

    def test_m2o_encode_invalid(self):
        """
        Test correct handling of unencodable sequences (many-to-one encoder) in strict mode
        """

# Path: kraken/lib/codec.py
# class PytorchCodec(object):
#     def __init__(self, charset: Union[Dict[str, Sequence[int]], Sequence[str], str], strict=False):
#     def __len__(self) -> int:
#     def is_valid(self) -> bool:
#     def max_label(self) -> int:
#     def encode(self, s: str) -> IntTensor:
#     def decode(self, labels: Sequence[Tuple[int, int, int, float]]) -> List[Tuple[str, int, int, float]]:
#     def merge(self, codec: 'PytorchCodec') -> Tuple['PytorchCodec', Set]:
#     def add_labels(self, charset: Union[Dict[str, Sequence[int]], Sequence[str], str]) -> 'PytorchCodec':
#     def __repr__(self):
# 
# Path: kraken/lib/exceptions.py
# class KrakenEncodeException(Exception):
# 
#     def __init__(self, message=None):
#         Exception.__init__(self, message)
# 
# class KrakenCodecException(Exception):
# 
#     def __init__(self, message=None):
#         Exception.__init__(self, message)


# Path: tests/test_codec.py
import unittest
from pytest import raises
from torch import IntTensor
from kraken.lib import codec
from kraken.lib.exceptions import KrakenEncodeException, KrakenCodecException

        Test correct handling of undecodable sequences (many-to-one decoder) in strict mode
        """
        with raises(KrakenEncodeException):
            self.m2o_codec_strict.decode(self.invalid_l_sequence)

    def test_o2m_decode_invalid(self):
        """
        Test correct handling of undecodable sequences (one-to-many decoder) in strict mode
        """
        with raises(KrakenEncodeException):
            self.o2m_codec_strict.decode(self.invalid_l_sequence)

    def test_m2m_decode_invalid(self):
        """
        Test correct handling of undecodable sequences (many-to-many decoder) in strict mode
        """
        with raises(KrakenEncodeException):
            self.m2m_codec_strict.decode(self.invalid_l_sequence)

    def test_o2o_encode_invalid(self):
        """
        Test correct handling of unencodable sequences (one-to-one encoder) in strict mode
        """
        with raises(KrakenEncodeException):
            self.o2o_codec_strict.encode(self.invalid_c_sequence)

    def test_m2o_encode_invalid(self):
        """
        Test correct handling of unencodable sequences (many-to-one encoder) in strict mode
        """

        with raises(KrakenEncodeException):