# AssertionError: 3 != 5 : expected 5 but got 3

- **ID:** `python/unittest-assert-equal-order`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

In unittest, `assertEqual(first, second)` reports the message as `first != second`. Developers often read the message right-to-left and fix the wrong side of the assertion, or assume the function under test is broken when the arguments were swapped.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   Always put the actual value first and add a msg for clarity:

self.assertEqual(result, 5, f'unexpected result: {result!r}')
   ```
2. **** (98% success)
   ```
   Use pytest's rich assertion rewriting instead, which prints both operands clearly:

assert result == 5
   ```

## Dead Ends

- **** — The test expectation was reversed; changing production code introduces a bug to satisfy a wrong assertion. (60% fail)
- **** — Silences the test and hides real regressions; the CI still reports green while behavior is wrong. (90% fail)
