# AssertionError: Expected 200 but got 404
assert 404 == 200

- **ID:** `python/pytest-failed-assertion-with-fixture`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A test function using a fixture that sets up an HTTP request expects a 200 status code, but the endpoint returns 404 due to incorrect URL or missing resource.

## Version Compatibility

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

## Workarounds

1. **** (90% success)
   ```
   Update the fixture to use the correct URL: `@pytest.fixture
def api_client():
    return Client('http://localhost:8000/api/v2')`
   ```
2. **** (95% success)
   ```
   Verify the endpoint exists by testing manually with curl before running the test suite.
   ```

## Dead Ends

- **** — This masks the actual problem; the test still fails to validate the correct behavior, leading to false positives in other scenarios. (90% fail)
- **** — The issue is not timing-related; the server is running but the endpoint is wrong or missing, so sleeping does not help. (50% fail)
