Skip to content

Unhandled 'ValueError: not enough values to unpack' when inspecting MagicMock.method_calls #610

@rpdelaney

Description

@rpdelaney
>>> m.method_calls
[call.get()]
>>> m.method_calls[0]
Traceback (most recent call last):
  File "/home/ryan/src/me/reed/.venv/bin/ptpython", line 10, in <module>
    sys.exit(run())
             ~~~^^
  File "/home/ryan/src/me/reed/.venv/lib/python3.13/site-packages/ptpython/entry_points/run_ptpython.py", line 217, in run
    embed_result = embed(  # type: ignore
        vi_mode=a.vi,
    ...<6 lines>...
        return_asyncio_coroutine=a.asyncio,
    )
  File "/home/ryan/src/me/reed/.venv/lib/python3.13/site-packages/ptpython/repl.py", line 575, in embed
    repl.run()
    ~~~~~~~~^^
  File "/home/ryan/src/me/reed/.venv/lib/python3.13/site-packages/ptpython/repl.py", line 174, in run
    self.run_and_show_expression(text)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/ryan/src/me/reed/.venv/lib/python3.13/site-packages/ptpython/repl.py", line 114, in run_and_show_expression
    self._show_result(result)
    ~~~~~~~~~~~~~~~~~^^^^^^^^
  File "/home/ryan/src/me/reed/.venv/lib/python3.13/site-packages/ptpython/repl.py", line 141, in _show_result
    self._get_output_printer().display_result(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        result=result,
        ^^^^^^^^^^^^^^
    ...<3 lines>...
        paginate=self.enable_pager,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/ryan/src/me/reed/.venv/lib/python3.13/site-packages/ptpython/printer.py", line 84, in display_result
    self._display_result(result, paginate=paginate)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ryan/src/me/reed/.venv/lib/python3.13/site-packages/ptpython/printer.py", line 118, in _display_result
    for line in lines:
                ^^^^^
  File "/home/ryan/src/me/reed/.venv/lib/python3.13/site-packages/ptpython/printer.py", line 222, in _insert_out_prompt_and_split_lines
    for i, line in enumerate(split_lines(result)):
                   ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "/home/ryan/src/me/reed/.venv/lib/python3.13/site-packages/prompt_toolkit/formatted_text/utils.py", line 88, in split_lines
    for style, string, *mouse_handler in fragments:
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected at least 2, got 0)
$ ptpython --version
3.0.29

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions