[PR #785] [CLOSED] serve tests: test_json_schema_text_format's schema failure only where jsonschema is installed #2826

Closed
opened 2026-11-04 02:03:24 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/785
Author: @sergqwer
Created: 10/4/2026
Status: ❌ Closed

Base: main ← Head: pr/responses-schema-test


📝 Commits (1)

  • c1d63cc serve tests: test_json_schema_text_format's schema failure only where jsonschema is installed

📊 Changes

1 file changed (+6 additions, -1 deletions)

View changed files

📝 serve/test_responses.py (+6 -1)

📄 Description

serve.test_responses.OverHttp.test_json_schema_text_format fails on every install without jsonschema, including a clean v0.1.39:

self.assertEqual((code, r["error"]["code"]), (502, "structured_output_failed"))
TypeError: 'NoneType' object is not subscriptable

jsonschema is optional (serve/structured.py). Without it, a json_schema answer is only checked to be one JSON object. The test's "bad" case answers {"n": 3} against a schema that wants n as a string. That answer is a JSON object, so it passes with a 200 where the test expects the 502.

The test now checks the schema failure only when jsonschema imports, which is how test_structured.py already treats it (HAVE_JSONSCHEMA). Everything before that part of the test still runs either way.

Checked on Windows 11 with the server's venv, which has no jsonschema: serve.test_responses was 1 error before and is OK now.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/785 **Author:** [@sergqwer](https://github.com/sergqwer) **Created:** 10/4/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/responses-schema-test` --- ### 📝 Commits (1) - [`c1d63cc`](https://github.com/Niko1221/Strata/commit/c1d63cc84310d2f4be5acaa60794f39472b53189) serve tests: test_json_schema_text_format's schema failure only where jsonschema is installed ### 📊 Changes **1 file changed** (+6 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `serve/test_responses.py` (+6 -1) </details> ### 📄 Description `serve.test_responses.OverHttp.test_json_schema_text_format` fails on every install without `jsonschema`, including a clean v0.1.39: ``` self.assertEqual((code, r["error"]["code"]), (502, "structured_output_failed")) TypeError: 'NoneType' object is not subscriptable ``` `jsonschema` is optional (`serve/structured.py`). Without it, a `json_schema` answer is only checked to be one JSON object. The test's "bad" case answers `{"n": 3}` against a schema that wants `n` as a string. That answer is a JSON object, so it passes with a 200 where the test expects the 502. The test now checks the schema failure only when `jsonschema` imports, which is how `test_structured.py` already treats it (`HAVE_JSONSCHEMA`). Everything before that part of the test still runs either way. Checked on Windows 11 with the server's venv, which has no `jsonschema`: `serve.test_responses` was 1 error before and is OK now. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:03:24 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2826
No description provided.