Skip to content

len(list) should be summarized in most cases #8

@pytestbot

Description

@pytestbot

Originally reported by: BitBucket: wtanksleyjr, GitHub: wtanksleyjr


I have some code which runs:

assert len(mylist) == 2 *** *** 10

When this fails, py.test prints out something like:

  • len([something, more, else, thing, bla, ...]) == (2 *** *** 10)

The problem is that it's impossible to tell exactly why the assert is failing -- the whole list can't reasonably be printed, and truncating the list loses the information that actually matters.

If a list inside a len is truncated, it would make sense to either display another level of simplification OR to print only the length (since you can't display the whole list).


Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions