Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/neuro_api/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
26 changes: 20 additions & 6 deletions tests/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
Expand Down