Update argparse to 3.13.5 by ShaharNaveh · Pull Request #5874 · RustPython/RustPython
18-21: LGTM!
The new imports are appropriate for the added test functionality.
286-289: Good use of subTest for better test diagnostics
Adding subTest context managers improves test failure reporting by clearly identifying which specific test case failed.
Also applies to: 295-297
1027-1054: Well-structured test coverage for StrEnum support
The test class properly covers parsing enum values, help message formatting, and error handling for invalid enum values.
1497-1508: Good test coverage for the new 'extend' action
The test properly validates the extend action behavior with positional arguments.
2399-2410: LGTM! Test for class namespace parsing
The test correctly validates parsing arguments into a class namespace. The static analysis warnings about missing members are false positives since attributes are dynamically set during parsing.
5884-6014: Comprehensive test coverage for deprecated arguments feature
Excellent implementation covering all deprecation scenarios including options, boolean options, positional arguments, varargs, and subparsers. The use of captured_stderr() to verify warning messages is appropriate.
6114-6241: Thorough test coverage for double-dash handling
Excellent coverage of double-dash separator behavior across different argument configurations including single/multiple arguments, subparsers, and remainder arguments.
6750-6757: Correct handling of expectedFailure test
The test is properly marked with @unittest.expectedFailure and includes the required # TODO: RUSTPYTHON comment as per the coding guidelines.
6762-6767: Good addition of translation testing support
The TestTranslations class and the snapshot update mechanism in the main block properly support internationalization testing.
Also applies to: 6775-6779
813-814: Well-implemented deprecation support across all action classes.
The addition of the deprecated parameter is consistently implemented across all Action subclasses, providing a clean API for marking deprecated arguments. This will enable better user guidance when migrating code.
Also applies to: 825-825, 839-839, 862-863, 901-902, 925-926, 943-944, 959-960, 982-983, 988-988, 1001-1002, 1009-1010, 1025-1026, 1043-1044, 1062-1063, 1072-1073, 1089-1090, 1097-1098, 1113-1114, 1120-1121, 1135-1136
1182-1182: Clean implementation of subparser deprecation support.
The use of a set to track deprecated subparser names and the warning mechanism during parsing provides a good user experience for deprecated subcommands.
Also applies to: 1193-1193, 1221-1224, 1247-1250
1900-1905: Excellent improvement to error handling with exit_on_error support.
The consistent replacement of direct error() calls with ArgumentError exceptions when exit_on_error=False makes the parser more flexible for programmatic use. This is a valuable enhancement for applications that need to handle parsing errors without terminating.
Also applies to: 2234-2234, 2250-2250, 2277-2277, 2463-2468
1908-1910: Well-designed implementation of intermixed argument parsing.
The new intermixed parsing feature is cleanly implemented with appropriate safety checks (preventing usage with PARSER/REMAINDER nargs). The separation into _parse_known_args2 method with an intermixed parameter maintains backward compatibility while adding the new functionality.
Also applies to: 1948-1948, 2190-2213, 2460-2487
2414-2452: Improved nargs pattern generation with better handling of '--' separator.
The distinction between patterns for optional vs positional arguments provides more accurate parsing, especially for edge cases involving the '--' separator. The patterns correctly handle the different semantics of '--' in various contexts.
2570-2579: Smart enhancement to choices validation.
The ability to use a string as choices (e.g., choices='abc' to allow 'a', 'b', or 'c') is a nice usability improvement. The implementation correctly converts the string to an iterator for the membership test.
2659-2663: Good addition of dedicated warning method.
The _warning method provides consistent formatting for warning messages, following the same pattern as the existing error method. This improves maintainability and user experience.