# Path: bento/utils/utils.py
# def extract_exception():
#     """Extract the last exception.
# 
#     Used to avoid the except ExceptionType as e, which cannot be written the
#     same across supported versions. I.e::
# 
#         try:
#             ...
#         except Exception, e:
#             ...
# 
#     becomes:
# 
#         try:
#             ...
#         except Exception:
#             e = extract_exception()
#     """
#     return sys.exc_info()[1]
# 
# def is_string(s):
#     return isinstance(s, str) or isinstance(s, unicode)


from bento.errors \
    import \
        ParseError
from bento.utils.utils \
    import \
        extract_exception, is_string
from bento.parser.lexer \
    import \
        BentoLexer
from bento.compat.api.moves import unittest
    foo
"""

        ref_str = "EXTRA_SOURCE_FILES_ID COLON INDENT WORD DEDENT"
        self._test(data, split(ref_str))

class TestMeta(TestLexer):
    def test_license(self):
        data = """\
License: PSF or  ZPL
"""

        ref_str = "LICENSE_ID COLON STRING"
        self._test(data, split(ref_str))

class TestErrorHandling(TestLexer):
    def test_multiline_string_count(self):
        data = """\
Description: hey
    how are
        you
        doing ?
NName: foo
"""

        self.lexer.input(data)
        try:
            list(self.lexer)
            self.fail("lexer did not raise expected ParseError")
        except ParseError:

# Path: bento/utils/utils.py
# def extract_exception():
#     """Extract the last exception.
# 
#     Used to avoid the except ExceptionType as e, which cannot be written the
#     same across supported versions. I.e::
# 
#         try:
#             ...
#         except Exception, e:
#             ...
# 
#     becomes:
# 
#         try:
#             ...
#         except Exception:
#             e = extract_exception()
#     """
#     return sys.exc_info()[1]
# 
# def is_string(s):
#     return isinstance(s, str) or isinstance(s, unicode)


# Path: bento/parser/tests/test_lexer.py
from bento.errors \
    import \
        ParseError
from bento.utils.utils \
    import \
        extract_exception, is_string
from bento.parser.lexer \
    import \
        BentoLexer
from bento.compat.api.moves import unittest

    foo
"""

        ref_str = "EXTRA_SOURCE_FILES_ID COLON INDENT WORD DEDENT"
        self._test(data, split(ref_str))

class TestMeta(TestLexer):
    def test_license(self):
        data = """\
License: PSF or  ZPL
"""

        ref_str = "LICENSE_ID COLON STRING"
        self._test(data, split(ref_str))

class TestErrorHandling(TestLexer):
    def test_multiline_string_count(self):
        data = """\
Description: hey
    how are
        you
        doing ?
NName: foo
"""

        self.lexer.input(data)
        try:
            list(self.lexer)
            self.fail("lexer did not raise expected ParseError")
        except ParseError:

            e = extract_exception()