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.
feat: call .name if it's a SettingsBase + Path support #4932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: call .name if it's a SettingsBase + Path support #4932
Changes from all commits
ee74daae3e6217d08e06313d739c4a4c45fe331ffc443f99eFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
Textual.set_statedocstring andRaisessection no longer match the accepted inputs: the signature now includesSettingsBaseWithName, and the runtime also acceptsVariableDescriptor, but the docs still say "Either str or VariableDescriptor" and "If state is not a string." Update the documentation/error wording to reflect the actual accepted types/behavior.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New behavior: allowing a
SettingsBaseinstance to be passed intoTextual.set_stateand converting it via.name()is not covered by the existing flobject unit tests (e.g., tests/test_flobject.py exercises string settings but never passes another settings object). Add a focused test that passes a named settings object and asserts the resulting stored string matches its name, including a negative case where.name()is absent.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no tests added to verify that the new feature works correctly. Based on the issue description and PR description, users should now be able to pass settings objects directly (e.g.,
param_1.report_definition = draginstead ofparam_1.report_definition = drag.name()). Consider adding tests to verify this functionality works as expected, for example by creating a settings object with a name() method and passing it directly to another setting that expects a string.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The generic type parameter has been changed from
SettingsBase[str]toSettingsBase[PathType], but this creates a type inconsistency. Theget_state()method inherited fromSettingsBaseis typed to returnStateT(which would bePathTypehere), but Fluent's API actually returns strings, not PathType objects. The_state_type = stron line 967 correctly indicates that Fluent stores strings internally. Consider keeping the generic parameter asSettingsBase[str]since that's what Fluent actually returns, and handle PathType conversion only inset_state()(which is already done). The type hint forset_statecan still acceptPathTypeas shown on line 970.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Path support added to
Filename.set_state()lacks test coverage. Consider adding a test that verifiespathlib.Pathobjects and other PathLike types can be passed to Filename settings objects. This would ensure theos.fspath()conversion works correctly for different PathType variants (Path objects, strings, bytes, etc.).Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.