--- id: pytest-unordered version: "0.8.0" license: MIT license_treatment: permissive maintenance: active --- # pytest-unordered — Test equality of unordered collections in pytest License: permissive · Maintenance: active · Downloads: 11.0M/mo ## What it is and what it does pytest-unordered is a pytest plugin that adds an `unordered()` wrapper function for assertions that compare collection contents while ignoring element order. It solves the common testing problem where APIs return data structures (lists, tuples, nested objects) in unpredictable or arbitrary order, making naive equality assertions fragile and test code verbose. The package shines when testing complex nested data structures: you can wrap only the parts where order doesn't matter, leaving other parts under strict order checking. It handles dictionaries, lists, tuples, and generators, and supports both container-type-strict and container-type-agnostic comparison modes. The single runtime dependency is pytest itself, making installation and integration straightforward. Use it for: - Test REST API responses that return lists of objects in unpredictable order without writing custom comparison logic. - Assert nested data structures (e.g., customer records with order lists) where only some levels should ignore order. - Compare collections of dictionaries or other unhashable types where set() or sorted() approaches fail. - Verify database query results or GraphQL responses that don't guarantee result ordering. - Write readable, maintainable assertions for complex JSON payloads in integration tests. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a pytest assertion helper to compare collections by content rather than order, useful for testing APIs that return data in arbitrary sequences. Yes. This is a focused, well-maintained tool that solves a real testing pain point with minimal friction. No security issues, permissive license, active development, and low dependency overhead make it a safe addition to any pytest-based test suite. ## Install pip install pytest-unordered uv add pytest-unordered poetry add pytest-unordered ## Installing pytest-unordered Before you install: Low friction: pure Python wheel with only pytest as a runtime dependency. Actively maintained with recent releases; last commit 2026-06-16. License in practice: MIT license (permissive) places no restrictions on use, modification, or distribution in your own projects. Quickstart: pip install pytest-unordered from pytest_unordered import unordered assert [1, 20, 300] == unordered([20, 300, 1]) ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 11.0M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags pytest unordered collection comparison, test collection content ignore order, assert lists equal regardless of order, pytest nested unordered assertions, api response testing unordered data, pytest collection equality without order, pytest-plugin, test-assertion, collection-comparison [View on SkillFed](https://skillfed.io/packages/pytest-unordered) · [View on PyPI](https://pypi.org/project/pytest-unordered/)