{"id":1672,"library":"pytest-unordered","title":"pytest-unordered","description":"pytest-unordered is a pytest plugin that provides a specialized `unordered()` matcher for asserting equality of collections (lists, sets, tuples, dictionaries) regardless of element order. It is currently at version 0.7.0 and typically releases new versions to support newer Python versions or add minor features.","status":"active","version":"0.7.0","language":"en","source_language":"en","source_url":"https://github.com/utapyngo/pytest-unordered","tags":["pytest","testing","collections","unordered","plugin"],"install":[{"cmd":"pip install pytest-unordered","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"This package is a pytest plugin and requires pytest to function.","package":"pytest","optional":false}],"imports":[{"symbol":"unordered","correct":"from pytest_unordered import unordered"},{"note":"Use for explicit list matching introduced in 0.5.0","symbol":"unordered_list","correct":"from pytest_unordered import unordered_list"},{"note":"Use for explicit set matching introduced in 0.5.0","symbol":"unordered_set","correct":"from pytest_unordered import unordered_set"},{"note":"Use for explicit dict matching introduced in 0.5.0","symbol":"unordered_dict","correct":"from pytest_unordered import unordered_dict"}],"quickstart":{"code":"import pytest\nfrom pytest_unordered import unordered\n\ndef test_list_order_agnostic_equality():\n    actual_list = [1, 3, 2]\n    expected_list = [2, 1, 3]\n    assert actual_list == unordered(expected_list)\n\ndef test_dict_order_agnostic_equality():\n    actual_dict = {'a': 1, 'b': 2}\n    expected_dict = {'b': 2, 'a': 1}\n    assert actual_dict == unordered(expected_dict)\n","lang":"python","description":"This quickstart demonstrates how to use the `unordered()` matcher within pytest to assert equality of lists and dictionaries where the order of elements or keys does not matter. Save this as a Python file (e.g., `test_order.py`) and run `pytest`."},"warnings":[{"fix":"Upgrade to Python 3.8+ or pin `pytest-unordered<0.6.0` in your `requirements.txt`.","message":"Support for Python 3.7 was dropped in version 0.6.0. If you are using Python 3.7, you must pin your `pytest-unordered` version.","severity":"breaking","affected_versions":">=0.6.0"},{"fix":"Always use `unordered()` as a function wrapping the expected collection, like `assert actual == unordered(expected)`.","message":"The `unordered` matcher became a factory function in 0.4.0. Prior to this, `unordered` might have been used as a direct collection type (e.g., `UnorderedList`). This change simplifies usage but may break older tests.","severity":"breaking","affected_versions":">=0.4.0"},{"fix":"Review tests that involve collections with `None` elements if upgrading from `<0.3.0` to ensure the new behavior aligns with expectations. Consult the 0.3.0 release notes for details.","message":"Default handling for `None` values within unordered collections was changed in version 0.3.0. This could subtly alter test results if your collections include `None` and you relied on the previous behavior.","severity":"gotcha","affected_versions":">=0.3.0"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}