Python Testing and Project Tools
Find invalid report settings
BOTIE
Examples, experiments and workspace controls
Connect a tool's inputs to see what it produces. You can try a branch before connecting it to Result.
Try your own inputs
Use a copy of the example to try your own data. Keep the problem's assumptions in mind, and predict the effect of a change before checking the output. You can also add another branch to compare two ways of doing the calculation.
Context for this challenge
Return complete environment rows with invalid timeout_seconds. Read that column, turn whole-number text into numbers, and check the range. Reverse the acceptance decisions so Keep flagged entries returns rejected rows. The first example should return an empty list.
Moving a setting outside the source code introduces new ways to enter an invalid value.
Read timeout_seconds from each row. The number reader produces null for unreadable text. The range check marks accepted values; reverse its decisions to keep the rejected rows.
Examples and results
- Timeout settings by environment
- environment
- local
- timeout_seconds
- "12"
- environment
- production
- timeout_seconds
- "30"
environment timeout_seconds local "12" production "30" - Smallest allowed timeout in seconds
1
- Largest allowed timeout in seconds
60
- Required result
[]
- Timeout settings by environment
- environment
- local
- timeout_seconds
- fast
- environment
- production
- timeout_seconds
- "12.5"
environment timeout_seconds local fast production "12.5" - Smallest allowed timeout in seconds
1
- Largest allowed timeout in seconds
60
- Required result
- environment
- local
- timeout_seconds
- fast
- environment
- production
- timeout_seconds
- "12.5"
environment timeout_seconds local fast production "12.5"
- Timeout settings by environment
- environment
- local
- timeout_seconds
- "1"
- environment
- production
- timeout_seconds
- "60"
environment timeout_seconds local "1" production "60" - Smallest allowed timeout in seconds
1
- Largest allowed timeout in seconds
60
- Required result
[]
Try a fresh construction
This clears this draft, including its undo history. Earlier successful attempts stay recorded. Build again without opening hints to record an independent attempt.
Stuck? Inspect a worked construction
The tools below form one possible solution. You can assemble it, follow its signals, and undo that change to return to your own construction.
Assumptions and test precision
The blocks use supplied settings and a small whole-number parser. They do not read environment variables or secrets. The Python task implements its stated configuration rules. Numerical tests allow a difference of 0.001. Lists and structures must also have the right shape.
A smaller deployment limit
This check uses the pieces from “Check each environment setting”.
BOTIE
- Timeout settings by environment
- environment
- local
- timeout_seconds
- "4"
- environment
- production
- timeout_seconds
- "12"
environment timeout_seconds local "4" production "12" - Smallest allowed timeout in seconds
2
- Largest allowed timeout in seconds
8
Saving your prediction runs your current construction on these inputs and checks the earlier examples too.
Build a construction in the workspace above first. This case will test those pieces.
Which setting values belong in a public diagnostic, and which should stay private?
Reject invalid configuration before starting the work that depends on it.
The blocks use supplied settings and a small whole-number parser. They do not read environment variables or secrets. The Python task implements its stated configuration rules.