Download data/rs/probes/googleapis_proto-plus-python_pr336.json from simonlqy/ProWM-Bench: direct link, hf CLI and curl.
- Browser
- Download file 5.09 kB
-
https://huggingface.co/datasets/simonlqy/ProWM-Bench/resolve/main/data/rs/probes/googleapis_proto-plus-python_pr336.json
- Command line
-
hf download hf://datasets/simonlqy/ProWM-Bench/data/rs/probes/googleapis_proto-plus-python_pr336.json
-
curl -L -o googleapis_proto-plus-python_pr336.json https://huggingface.co/datasets/simonlqy/ProWM-Bench/resolve/main/data/rs/probes/googleapis_proto-plus-python_pr336.json
5.09 kB
| { | |
| "build_script": "", | |
| "build_workdir": ".", | |
| "bundle_artifact": "", | |
| "decision_relevant_fields": [ | |
| "adapter_state.compact" | |
| ], | |
| "execution_mode": "node", | |
| "expected_page_errors": [], | |
| "instance_id": "googleapis_proto-plus-python_pr336", | |
| "language": "python", | |
| "payload": {}, | |
| "predicate_description": "The compact JSON output equals the expected single-line string with no newlines.", | |
| "predicate_js": "(s) => s.adapter_state.compact === '{\"massKg\": 100, \"name\": \"no_new_lines_squid\"}'", | |
| "product_output_kind": "rendered_document", | |
| "program_js": "import html\nimport json\nimport os\nimport sys\n\nsys.path.insert(0, \"/testbed\")\n\n\ndef main():\n state = {\n \"compact\": None,\n \"pretty\": None,\n \"compact_error\": None,\n \"pretty_error\": None,\n }\n\n try:\n import proto\n\n class Squid(proto.Message):\n mass_kg = proto.Field(proto.INT32, number=1)\n name = proto.Field(proto.STRING, number=2)\n\n s = Squid(mass_kg=100, name=\"no_new_lines_squid\")\n\n try:\n state[\"compact\"] = Squid.to_json(s, indent=None)\n except Exception as e:\n state[\"compact_error\"] = {\n \"type\": type(e).__name__,\n \"message\": str(e),\n }\n\n try:\n state[\"pretty\"] = Squid.to_json(s, indent=2)\n except Exception as e:\n state[\"pretty_error\"] = {\n \"type\": type(e).__name__,\n \"message\": str(e),\n }\n except Exception as e:\n state[\"import_error\"] = {\n \"type\": type(e).__name__,\n \"message\": str(e),\n }\n\n state[\"compact_has_newlines\"] = (\n isinstance(state[\"compact\"], str) and \"\\n\" in state[\"compact\"]\n )\n state[\"pretty_has_newlines\"] = (\n isinstance(state[\"pretty\"], str) and \"\\n\" in state[\"pretty\"]\n )\n\n output_path = sys.argv[2]\n\n if state[\"compact\"] is not None:\n compact_display = state[\"compact\"]\n compact_class = \"json-output\"\n elif state.get(\"compact_error\"):\n compact_display = (\n f\"Error: {state['compact_error']['type']}: \"\n f\"{state['compact_error']['message']}\"\n )\n compact_class = \"json-output error\"\n else:\n compact_display = \"N/A\"\n compact_class = \"json-output error\"\n\n if state[\"pretty\"] is not None:\n pretty_display = state[\"pretty\"]\n pretty_class = \"json-output\"\n elif state.get(\"pretty_error\"):\n pretty_display = (\n f\"Error: {state['pretty_error']['type']}: \"\n f\"{state['pretty_error']['message']}\"\n )\n pretty_class = \"json-output error\"\n else:\n pretty_display = \"N/A\"\n pretty_class = \"json-output error\"\n\n state_json = json.dumps(state).replace(\"<\", \"\\\\u003c\")\n\n page = f\"\"\"<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>proto-plus to_json indent</title>\n<style>\n body {{ font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif; margin: 2em; line-height: 1.5; color: #24292f; }}\n h1 {{ font-size: 1.5em; }}\n h2 {{ font-size: 1.1em; margin-top: 1.5em; }}\n .json-output {{ font-family: ui-monospace, SFMono-Regular, Consolas, \"Liberation Mono\", Menlo, monospace; background: #f6f8fa; padding: 1em; border: 1px solid #d0d7de; border-radius: 6px; white-space: pre-wrap; word-break: break-all; }}\n .error {{ color: #cf222e; background: #fff5f5; border-color: #ffc2c2; }}\n</style>\n</head>\n<body>\n<h1>proto-plus Message.to_json indent parameter</h1>\n<h2>indent=None (compact)</h2>\n<div class=\"{compact_class}\" id=\"compact-output\">{html.escape(compact_display)}</div>\n<h2>indent=2 (pretty-printed)</h2>\n<div class=\"{pretty_class}\" id=\"pretty-output\">{html.escape(pretty_display)}</div>\n<script>\nwindow.__WM_STATE__ = {state_json};\nwindow.__WM_READY__ = true;\n</script>\n</body>\n</html>\"\"\"\n\n with open(output_path, \"w\", encoding=\"utf-8\") as f:\n f.write(page)\n\n trace_path = os.environ.get(\"WMMB_MODULE_TRACE_PATH\")\n if trace_path:\n loaded = sorted(\n {\n m.__file__\n for m in sys.modules.values()\n if getattr(m, \"__file__\", None) and \"/testbed/\" in m.__file__\n }\n )\n with open(trace_path, \"w\", encoding=\"utf-8\") as f:\n json.dump({\"repository_modules_loaded\": loaded}, f)\n\n\nif __name__ == \"__main__\":\n main()", | |
| "rationale": "Calling to_json with indent=None should return a single-line compact JSON string, but the buggy revision rejects the indent keyword and throws TypeError.", | |
| "repo": "googleapis/proto-plus-python", | |
| "schema_version": "worldmodelmmbench.render-probe.v3", | |
| "title": "Message.to_json indent=None produces compact JSON", | |
| "viewport": [ | |
| 1280, | |
| 960 | |
| ], | |
| "volatile_fields": [] | |
| } | |