A number that is not finite is stored as None at a field that accepts None
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
issue 指向 ess/spec/request_types.py,具体是 inline,并说明请求验证测试已移至 request_types_test.py。先阅读 inline 和相关测试,然后运行该测试文件。如果字段接受 None 时非有限数会被拒绝(包括在组和列表中),且现有对 None 有效行为的测试仍然覆盖到,就算完成。
由索引模型根据 Issue 内容生成。
描述
A number that is not finite is refused at a float field, because JSON holds it as null. At a field that also accepts None, it is stored as None and the request is accepted, so the workflow runs with None instead of the value given.
import math
from pathlib import Path
from pydantic import BaseModel
from ess.spec.request_types import held
class P(BaseModel):
stop: float | None = None
class Q(BaseModel):
stop: float = 1.0
files = lambda name, marker: name
local_path = lambda ref: Path('x')
held(P, 'stop', math.inf, files, local_path) # (None, []): accepted, stored as None
held(Q, 'stop', math.inf, files, local_path) # ParamsError: stop: has no JSON form that reads back as the value
The same holds inside groups and lists, at any field whose type accepts None.
Cause: request_types.inline checks that the stored JSON form reads back as itself (stored vs the JSON form of again), not that it reads back as the value given (made). inf becomes null in stored, null validates as None, and None has the JSON form null again, so the check passes.
Found while moving the request-validation tests to request_types_test.py.
- 主要语言
- Python
- 星标
- 0
- 派生
- 0
- 平均合并
- 16 小时 17 分钟
- 30 天内合并 PR
- 56
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
scipp/essapps 的其他 Issue
-
Mark a field that a file fills with an annotation, not a FileModel可能已有人在做 @SimonHeybrock 今天认领。 未关闭
维护者通常 1 天内回复
-
Params language: one language at every depth可能已有人在做 @SimonHeybrock 于 1 天前认领。 未关闭
维护者通常 1 天内回复
-
enhancement
难度 5/5 一周以上 新手友好度 15/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 8/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 45/100
维护者通常 1 天内回复
相似的 Issue
-
needs-area-label
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 2 天内回复
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 84/100
Official-Space-AI/OpenPhysGraspGen#114 ·
维护者通常 2 天内回复
-
changelog investigate
难度 2/5 1-3 小时 新手友好度 62/100
ramnes/notion-sdk-py#441 ·
-
qa_bug
难度 2/5 1-3 小时 新手友好度 78/100
NVIDIA-NeMo/Gym#5644 ·
维护者通常 2 天内回复
-
BUG: catalog database credentials printed to logs at startup可能已有人在做 @cjboyle 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复