mirror of
https://github.com/kennethreitz/responder.git
synced 2026-06-05 06:46:14 +00:00
Fix test assertions that could never fail
- test_background_task_exception: `or True` made assert always pass - test_form_uploads_without_multipart: `or r.status_code < 500` masked wrong expected value (dict() of QueryDict returns lists, not scalars) - test_graphql_text_query: `< 500` replaced with exact `== 200` Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -85,7 +85,7 @@ def test_background_task_exception(capsys):
|
|||||||
time.sleep(0.2) # let the done callback fire
|
time.sleep(0.2) # let the done callback fire
|
||||||
|
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
assert "ValueError" in captured.err or True # traceback goes to stderr
|
assert "ValueError" in captured.err or "ValueError" in captured.out
|
||||||
|
|
||||||
|
|
||||||
def test_background_run():
|
def test_background_run():
|
||||||
@@ -112,7 +112,8 @@ def test_form_uploads_without_multipart(api):
|
|||||||
content="name=hello&value=world",
|
content="name=hello&value=world",
|
||||||
headers={"Content-Type": "application/x-www-form-urlencoded"},
|
headers={"Content-Type": "application/x-www-form-urlencoded"},
|
||||||
)
|
)
|
||||||
assert r.json() == {"name": "world", "value": "world"} or r.status_code < 500
|
assert r.status_code == 200
|
||||||
|
assert r.json() == {"name": ["hello"], "value": ["world"]}
|
||||||
|
|
||||||
|
|
||||||
# --- models.py coverage ---
|
# --- models.py coverage ---
|
||||||
@@ -469,7 +470,7 @@ def test_graphql_text_query(api):
|
|||||||
content="{ hello }",
|
content="{ hello }",
|
||||||
headers={"Content-Type": "text/plain"},
|
headers={"Content-Type": "text/plain"},
|
||||||
)
|
)
|
||||||
assert r.status_code < 500
|
assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
def test_openapi_info_fields():
|
def test_openapi_info_fields():
|
||||||
|
|||||||
Reference in New Issue
Block a user