#37052 new Cleanup/optimization

Cleanup: Added test coverage for camel_case_to_spaces utility

Reported by: Sagar kumar Owned by:
Component: Core (Serialization) Version: 6.0
Severity: Normal Keywords: tests, utils, text
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

While investigating the django.utils.text.camel_case_to_spaces utility, I noticed that it currently lacks comprehensive test coverage for several common edge cases. While the function works as intended for standard PascalCase, its behavior with acronyms, digits, and surrounding whitespace isn't explicitly verified in the test suite.

I have developed a suite of test cases to be added to tests/utils_tests/test_text.py. These tests ensure the utility handles:
- Standard camelCase and PascalCase.
- Strings containing acronyms (e.g., "HTTPResponse").
- Alphanumeric strings (e.g., "Version2Update").
- Edge cases like empty strings and leading/trailing whitespace.

Adding these tests will harden the utility against regressions during future refactors and ensure consistent behavior across the framework where this utility is used for human-readable labels.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top