2022-05-12    Share on: Twitter | Facebook | HackerNews | Reddit

Pytest Check if Lists Are Equal

In the assertions this can be useful to check if two lists are equal:

def check_lists_equal(list_1: list, list_2: list) -> bool:
    """Check if two lists are equal."""
    return len(list_1) == len(list_2) and sorted(list_1) == sorted(list_2)



Tags:  pytest python assert