# AssertionError: assert {'a': 1, 'b': 2} == {'b': 2, 'a': 1}

- **ID:** `python/pytest-assert-dict-equality`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

字典比较看似相同但顺序不同，pytest 的断言重写可能因顺序导致误报，但实际字典相等。

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 7.4.0 | active | — | — |

## Workarounds

1. **** (100% success)
   ```
   Python 字典相等性不依赖顺序，`assert dict1 == dict2` 应该通过，检查是否有其他差异。
   ```
2. **** (90% success)
   ```
   如果值包含浮点数，使用 `assert actual == pytest.approx(expected)`。
   ```

## Dead Ends

- **** — 字典无法排序，且不必要。 (80% fail)
- **** — 如果字典顺序影响某些逻辑，可能掩盖问题。 (50% fail)
