# TypeError: unhashable type: 'dict'

- **ID:** `python/unittest-testcase-assertcountequal-unhashable`
- **Domain:** python
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

assertCountEqual builds a Counter of both sequences, which requires hashable elements. Lists of dicts fail because dict is unhashable.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## Workarounds

1. **** (92% success)
   ```
   actual = sorted(actual, key=lambda d: d['id'])
expected = sorted(expected, key=lambda d: d['id'])
self.assertEqual(actual, expected)
   ```
2. **** (88% success)
   ```
   from collections import Counter
self.assertEqual(
    Counter(frozenset(d.items()) for d in actual),
    Counter(frozenset(d.items()) for d in expected),
)
   ```

## Dead Ends

- **** — Loses key ordering independence; two equal dicts with different insertion order produce different strings and the test fails spuriously. (70% fail)
- **** — assertEqual is order-sensitive and fails when the sequences contain the same items in a different order. (75% fail)
