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, diff --git a/tests/test_command.py b/tests/test_command.py index cf8298d..5d157ab 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"