fix: fix Literal with widget_type#586
Conversation
WalkthroughThis change introduces a new function to handle Changes
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Review Status
Actionable comments generated: 0
Files selected for processing (2)
- src/magicgui/type_map/_type_map.py (3 hunks)
- tests/test_types.py (1 hunks)
Files skipped from review due to trivial changes (1)
- src/magicgui/type_map/_type_map.py
Additional comments (Suppressed): 1
tests/test_types.py (1)
- 192-199: The new test case
test_pick_widget_literal()is well written and covers the changes made in the type map file. It checks whether the correct widget class (widgets.RadioButtons) is returned for aLiteralannotation and whether the choices are correctly extracted from theLiteralannotation. This addition enhances the test coverage for the changes made in the type map file.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #586 +/- ##
=======================================
Coverage 87.61% 87.61%
=======================================
Files 39 39
Lines 4528 4538 +10
=======================================
+ Hits 3967 3976 +9
- Misses 561 562 +1
☔ View full report in Codecov by Sentry. |
fixes #585 where providing widget_type didn't get to the parsing of Literal
Summary by CodeRabbit
Literaltype annotations in the magicgui type map. The update introduces a function that correctly extracts choices and nullable flags fromLiteraltypes, improving the accuracy of widget selection.test_pick_widget_literal()to ensure the correct widget class is returned forLiteralannotations and that the choices are accurately extracted.