========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================= test session starts ==========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
platform linux -- Python 3.10.12, pytest-9.0.3, pluggy-1.6.0 -- /usr/bin/python3
cachedir: .pytest_cache
metadata: {'Python': '3.10.12', 'Platform': 'Linux-6.8.0-1026-gke-x86_64-with-glibc2.35', 'Packages': {'pytest': '9.0.3', 'pluggy': '1.6.0'}, 'Plugins': {'metadata': '3.1.1', 'anyio': '4.13.0', 'cov': '7.1.0', 'json-report': '1.5.0'}}
rootdir: /workspace/imapclient
configfile: pyproject.toml
plugins: metadata-3.1.1, anyio-4.13.0, cov-7.1.0, json-report-1.5.0
collected 29 items

tests/test_response_parser.py::TestParseFetchResponse::test_Address_str FAILED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   [  3%]
tests/test_response_parser.py::TestParseFetchResponse::test_Address_str_ignores_encoding_error FAILED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            [  6%]
tests/test_response_parser.py::TestParseFetchResponse::test_BODY FAILED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          [ 10%]
tests/test_response_parser.py::TestParseFetchResponse::test_BODYSTRUCTURE FAILED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 [ 13%]
tests/test_response_parser.py::TestParseFetchResponse::test_BODY_HEADER_FIELDS FAILED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            [ 17%]
tests/test_response_parser.py::TestParseFetchResponse::test_ENVELOPE FAILED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      [ 20%]
tests/test_response_parser.py::TestParseFetchResponse::test_ENVELOPE_with_empty_addresses FAILED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 [ 24%]
tests/test_response_parser.py::TestParseFetchResponse::test_ENVELOPE_with_invalid_date FAILED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    [ 27%]
tests/test_response_parser.py::TestParseFetchResponse::test_ENVELOPE_with_no_date FAILED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         [ 31%]
tests/test_response_parser.py::TestParseFetchResponse::test_FLAGS PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         [ 34%]
tests/test_response_parser.py::TestParseFetchResponse::test_INTERNALDATE FAILED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  [ 37%]
tests/test_response_parser.py::TestParseFetchResponse::test_INTERNALDATE_NIL PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              [ 41%]
tests/test_response_parser.py::TestParseFetchResponse::test_INTERNALDATE_normalised FAILED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       [ 44%]
tests/test_response_parser.py::TestParseFetchResponse::test_UID FAILED                                                                                                                                                                                                                                                                                                                                                                                                   <response clipped><NOTE>Due to the max output limit, only part of the full response has been shown to you.</NOTE>e_parser.py:153: ValueError

During handling of the above exception, another exception occurred:

self = <tests.test_response_parser.TestParseFetchResponse testMethod=test_mixed_types>

    def test_mixed_types(self):
        self.assertEqual(
>           parse_fetch_response(
                [
                    (
                        b'1 (INTERNALDATE " 9-Feb-2007 17:08:08 +0100" RFC822 {21}',
                        b"Subject: test\r\n\r\nbody",
                    ),
                    b")",
                ]
            ),
            {
                1: {
                    b"INTERNALDATE": datetime_to_native(
                        datetime(2007, 2, 9, 17, 8, 8, 0, FixedOffset(60))
                    ),
                    b"RFC822": b"Subject: test\r\n\r\nbody",
                    b"SEQ": 1,
                }
            },
        )

tests/test_response_parser.py:657:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _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_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

tokens = <imapclient.response_lexer.TokenSource object at 0x717d235c4fd0>

    def _parse_fetch_item(tokens: TokenSource) -> Tuple[Optional[int], Dict[bytes, Any]]:
        tok_iter = iter(tokens)

        try:
            msg_id_tok = next(tok_iter)
        except StopIteration:
            return None, {}

        try:
            msg_id = int(msg_id_tok)
        except ValueError:
>           raise ProtocolError('Unexpected fetch response: %r' % msg_id_tok)
E           imapclient.exceptions.ProtocolError: Unexpected fetch response: b')'

imapclient/response_parser.py:155: ProtocolError
______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ TestParseFetchResponse.test_partial_fetch _______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

tokens = <imapclient.response_lexer.TokenSource object at 0x717d237e7fd0>

    def _parse_fetch_item(tokens: TokenSource) -> Tuple[Optional[int], Dict[bytes, Any]]:
        tok_iter = iter(tokens)

        try:
            msg_id_tok = next(tok_iter)
        except StopIteration:
            return None, {}

        try:
>           msg_id = int(msg_id_tok)
E           ValueError: invalid literal for int() with base 10: b')'

imapclient/response_parser.py:153: ValueError

During handling of the above exception, another exception occurred:

self = <tests.test_response_parser.TestParseFetchResponse testMethod=test_partial_fetch>

    def test_partial_fetch(self):
        body = b"01234567890123456789"
        self.assertEqual(
>           parse_fetch_response([(b"123 (UID 367 BODY[]<0> {20}", body), b")"]),
            {367: {b"BODY[]<0>": body, b"SEQ": 123}},
        )

tests/test_response_parser.py:492:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _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 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

tokens = <imapclient.response_lexer.TokenSource object at 0x717d237e7fd0>

    def _parse_fetch_item(tokens: TokenSource) -> Tuple[Optional[int], Dict[bytes, Any]]:
        tok_iter = iter(tokens)

        try:
            msg_id_tok = next(tok_iter)
        except StopIteration:
            return None, {}

        try:
            msg_id = int(msg_id_tok)
        except ValueError:
>           raise ProtocolError('Unexpected fetch response: %r' % msg_id_tok)
E           imapclient.exceptions.ProtocolError: Unexpected fetch response: b')'

imapclient/response_parser.py:155: ProtocolError
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ TestParseFetchResponse.test_simple_pairs _______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

self = <tests.test_response_parser.TestParseFetchResponse testMethod=test_simple_pairs>

    def test_simple_pairs(self):
>       self.assertEqual(
            parse_fetch_response([b'23 (ABC 123 StUfF "hello")']),
            {23: {b"ABC": 123, b"STUFF": b"hello", b"SEQ": 23}},
        )
E       AssertionError: defaultdict(<class 'dict'>, {23: {b'SEQ': 23, b'ABC': 123, b'StUfF': b'hello'}}) != {23: {b'ABC': 123, b'STUFF': b'hello', b'SEQ': 23}}

tests/test_response_parser.py:242: AssertionError
======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================= short test summary info ========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
FAILED tests/test_response_parser.py::TestParseFetchResponse::test_Address_str - AttributeError: 'NoneType' object has no attribute 'decode'
FAILED tests/test_response_parser.py::TestParseFetchResponse::test_Address_str_ignores_encoding_error - UnicodeEncodeError: 'ascii' codec can't encode character '\ufffd' in position 1: ordinal not in range(128)
FAILED tests/test_response_parser.py::TestParseFetchResponse::test_BODY - AssertionError: defaultdict(<class 'dict'>, {123: {b'SEQ'[101 chars]1)}}) != {317: {b'BODY': (b'TEXT', b'PLAIN', (b'CH[59 chars]123}}
FAILED tests/test_response_parser.py::TestParseFetchResponse::test_BODYSTRUCTURE - AssertionError: defaultdict(<class 'dict'>, {123: {b'SEQ'[110 chars]1)}}) != {317: {b'BODYSTRUCTURE': (b'TEXT', b'PLAI[68 chars]123}}
FAILED tests/test_response_parser.py::TestParseFetchResponse::test_BODY_HEADER_FIELDS - imapclient.exceptions.ProtocolError: Unexpected fetch response: b')'
FAILED tests/test_response_parser.py::TestParseFetchResponse::test_ENVELOPE - AssertionError: (b'Sun, 24 Mar 2013 22:06:10 +0200', b'su[289 chars]id>') != Envelope(date=datetime.datetime(2013, 3, [593 chars]id>')
FAILED tests/test_response_parser.py::TestParseFetchResponse::test_ENVELOPE_with_empty_addresses - AssertionError: (None, b'subject', ((b'name', None, b'add[317 chars]id>') != Envelope(date=None, subject=b'subject', f[563 chars]id>')
FAILED tests/test_response_parser.py::TestParseFetchResponse::test_ENVELOPE_with_invalid_date - AssertionError: (b'wtf', b'subject', None, None, None, No[41 chars]id>') != Envelope(date=None, subject=b'subject', f[115 chars]id>')
FAILED tests/test_response_parser.py::TestParseFetchResponse::test_ENVELOPE_with_no_date - AssertionError: (None, b'subject', None, None, None, None[39 chars]id>') != Envelope(date=None, subject=b'subject', f[115 chars]id>')
FAILED tests/test_response_parser.py::TestParseFetchResponse::test_INTERNALDATE - AssertionError: b' 9-Feb-2007 17:08:08 -0430' != datetime.datetime(2007, 2, 9, 17, 8, 8, t[64 chars]dd0>)
FAILED tests/test_response_parser.py::TestParseFetchResponse::test_INTERNALDATE_normalised - AttributeError: 'bytes' object has no attribute 'tzinfo'
FAILED tests/test_response_parser.py::TestParseFetchResponse::test_UID - AssertionError: defaultdict(<class 'dict'>, {23: {b'SEQ': 23, b'UID': 76}}) != {76: {b'SEQ': 23}}
FAILED tests/test_response_parser.py::TestParseFetchResponse::test_literals - imapclient.exceptions.ProtocolError: Unexpected fetch response: b'RFC822'
FAILED tests/test_response_parser.py::TestParseFetchResponse::test_literals_and_keys_with_square_brackets - imapclient.exceptions.ProtocolError: Unexpected fetch response: b')'
FAILED tests/test_response_parser.py::TestParseFetchResponse::test_mixed_types - imapclient.exceptions.ProtocolError: Unexpected fetch response: b')'
FAILED tests/test_response_parser.py::TestParseFetchResponse::test_partial_fetch - imapclient.exceptions.ProtocolError: Unexpected fetch response: b')'
FAILED tests/test_response_parser.py::TestParseFetchResponse::test_simple_pairs - AssertionError: defaultdict(<class 'dict'>, {23: {b'SEQ': 23, b'ABC': 123, b'StUfF': b'hello'}}) != {23: {b'ABC': 123, b'STUFF': b'hello', b'SEQ': 23}}
==================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================== 17 failed, 12 passed in 0.22s =====================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
[The command completed with exit code 1.]
[Current working directory: /workspace/imapclient]
[Python interpreter: /usr/bin/python]
[Command finished with exit code 1]