Repository navigation
test(python): pin what timeseries.create refuses - #166
Merged
Merged
Conversation
…draft The invalid-input tests in test_timeseries_sync.py and _async.py sat inside a string literal since the Python SDK landed, so pytest never collected them, and they could not have run as written. They are gone. test_timeseries_rejections.py covers what is actually refused, and where. Wrongly typed input (unit=0, a non-string metadata value) is a TypeError from the constructor and an unknown value_type a ValueError; neither reaches the api. The api answers the rest with a 400 constraint-violation naming each field: unit absent, None, empty or blank; a unit_external_id without a unit, which REST does not fill in from the catalogue the way the MCP tool does; unit over 64 characters; unit_external_id, name and external_id under their minimum lengths. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: jgjesdal <jostein@intellistream.ai>
olavgg
approved these changes
Sep 29, 2026
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The "invalid input" tests in
test_timeseries_sync.pyandtest_timeseries_async.py, the ones carryingxfail(reason="TBD what are invalid units"), were inside a"""TODO …"""string literal, so pytest never collected them. They could not have run anyway: the indentation was broken, they passedunits=forunit, and they never calledcreate. This deletes them and addstest_timeseries_rejections.py, built from probing the api.Refused in Python, before any request
unit=0,unit_external_id=0,external_id=12,name=5,value_type=None, non-string metadata values →TypeError(the binding's fields are typedstr)value_typeof"",big_int,stringsorhex→ValueErrorRefused by the api — 400
constraint-violation, withfieldsnaming exactly the offending propertyunitabsent,None,""or" "→unit: timeseries.unit.not.blankunit_external_id→ same. REST does not fillunitin from the catalogue, unlike the MCPtimeseries_createtool.unitof 65 characters (64 is accepted, and the test checks that boundary)unit_external_idof""orab(min 3),nameof"",abor 513 characters,external_idofabThings the api accepts that the tests do not pin
Worth a look on the platform side, but a product decision rather than something to encode here:
unitExternalId(no_such_unit_xyz) is stored; REST never looks it upunitExternalIdthat disagrees withunit(Celsiusonpressure_bar) is storedunitExternalId(" ") passes the size check and is stored as-isunitExternalIdsize violation'smessageis the literal{unit.externalId.size}, an unresolved i18n keyNo SDK surface changes, so no docs pages are affected.
Test plan
test_timeseries_rejections.py,test_timeseries_sync.py,test_timeseries_async.pyagainst a local backend: 62 passed🤖 Generated with Claude Code