Repository navigation
fix(stations): name mirrored=False on an unplaced valve station - #572
Merged
Merged
Conversation
add_valve_station() refuses the run options mirrored, gap, bypass_rise and drain_drop on a station with no x/y, and names each one given. The three distances default to None, but mirrored defaulted to False, so mirrored=False could not be told from silence: it was accepted, and a refusal for another option left it out of the names. mirrored now defaults to None and resolves to False once the run is drawn, so any stated value is named. A pinned station draws as before, and place_valve_station_on() still accepts mirrored=False. The test module's documentation is rewritten to the NumPy style. Closes #541
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
add_valve_station()refuses the four run options (mirrored,gap,bypass_rise,drain_drop) on a station with nox/y, and its docs and error say every option given is named.mirroreddefaulted toFalse, somirrored=Falsecould not be told from leaving it out. It was accepted, and left out of the names when another option was refused.mirrorednow defaults toNone, like the three distances. No drawing changes.Related Issues
Closes #541
Refs: #527, #535
Changes
pandid/flowsheet.py:add_valve_station(mirrored: bool | None = None). Any value given counts as stated and is refused by name withoutx/y. The value resolves toFalseonce the run is drawn, both for the pinned run and for the recordedStationAssembly. The docstring and the comment beside the check are updated.place_valve_station_on(): unchanged. A station placed on a stream has a drawn run, so it still takesmirrored=False.Tests (
tests/test_valve_station.py):mirrored=Falsealone, and withgap, is refused by name;mirrored=Falsecall leaves the sheet untouched;mirrored=Falseexactly as it draws the option left out;place_valve_station_on(..., mirrored=False)is accepted.The two refusal tests fail on
main. The module's documentation is rewritten to the NumPy style, with each test's docstring now a "Check that …" summary. Apart from the new and changed tests, the test code is unchanged: the files compare equal as syntax trees with docstrings removed.CHANGELOG.md: an[Unreleased]Fixed entry.How to Test
Evidence
add_valve_station("CV-1", mirrored=False)ValueErrornamingmirrored=add_valve_station("CV-1", mirrored=False, gap=DEFAULT_GAP)gap=onlymirrored=, gap=add_valve_station("CV-1")add_valve_station(..., x=300, y=400, mirrored=False)place_valve_station_on(run, "CV-1", mirrored=False)mainfor 46 drawings (the 21 examples as authored and with placement stripped, plus four benchmark sheets).git diff --checkare clean;pandid/plus the existing__all__warning;main, which tests/ carries 1044 pyright diagnostics, so the pyright CI gate covers pandid/ only #530 tracks; none were added.Checklist
mainand the branch is mergeable🤖 Generated with Claude Code