From fa519a57a3127db002ceebb0f017f73fc7088ebc Mon Sep 17 00:00:00 2001 From: Thorminate Date: Sun, 8 Feb 2026 20:05:40 +0100 Subject: [PATCH 1/3] allow float type in schema validation --- src/neuro_api/command.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neuro_api/command.py b/src/neuro_api/command.py index 782a70d..104c049 100644 --- a/src/neuro_api/command.py +++ b/src/neuro_api/command.py @@ -156,7 +156,7 @@ def check_invalid_keys_recursive( for key, value in sub_schema.items(): if key in INVALID_SCHEMA_KEYS: invalid_keys.append(key) - elif isinstance(value, (str, int, bool)): + elif isinstance(value, (str, int, bool, float)): pass elif isinstance(value, dict): # Probably not quite correct to cast to SchemaObject here, From 62f14f5180e9f41f21e13dc0d7d540f68facda75 Mon Sep 17 00:00:00 2001 From: Thorminate Date: Mon, 9 Feb 2026 15:23:11 +0100 Subject: [PATCH 2/3] Add test for large schemas --- tests/test_command.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/tests/test_command.py b/tests/test_command.py index cf8298d..5bde102 100644 --- a/tests/test_command.py +++ b/tests/test_command.py @@ -341,6 +341,26 @@ def test_check_action_invalid_schema_key() -> None: check_action(action) +def test_check_action_populous_schema() -> None: + action = Action( + name="valid_action", + description="A valid action", + schema={ + "type": "object", + "properties": { + "value": {"type": "string", "enum": ["a", "b"]}, + "count": {"type": "number", "minimum": 0.0, "maximum": 100.0}, + "array": { + "type": "array", + "items": {"type": "boolean", "const": True}, + "maxItems": 100 + }, + } + }, + ) + check_action(action) + + def test_check_typed_dict() -> None: data = { "id": "waffles", @@ -417,12 +437,6 @@ class Data(TypedDict): assert check_typed_dict(data, Data) == data -# ... (keep all existing tests) ... - - -# NEW TESTS - Add these to improve coverage: - - def test_format_command_no_game() -> None: """Test format_command without game parameter.""" command = "test_command" From f580016d967d277e1d5173b69c0b7f1faab10a6e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 9 Feb 2026 14:23:19 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_command.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_command.py b/tests/test_command.py index 5bde102..5d157ab 100644 --- a/tests/test_command.py +++ b/tests/test_command.py @@ -346,16 +346,16 @@ def test_check_action_populous_schema() -> None: name="valid_action", description="A valid action", schema={ - "type": "object", + "type": "object", "properties": { "value": {"type": "string", "enum": ["a", "b"]}, "count": {"type": "number", "minimum": 0.0, "maximum": 100.0}, "array": { - "type": "array", - "items": {"type": "boolean", "const": True}, - "maxItems": 100 + "type": "array", + "items": {"type": "boolean", "const": True}, + "maxItems": 100, }, - } + }, }, ) check_action(action)