Replaced the old comma-split based email parsing with `email.utils.getaddresses`
to correctly handle RFC 5322 formatted addresses, including display names
containing commas (e.g. `"Last, First" <email@example.com>`).
The previous implementation incorrectly split on commas and treated parts of
display names as standalone emails, causing valid inputs to fail validation and
breaking Communication creation (e.g. `"Gritton, Howard" <hgrit@example.com>`).
The new validator:
- correctly parses display names with commas
- handles multiple addresses and multiline input
- skips undisclosed recipients
- preserves existing EMAIL_MATCH_PATTERN validation
- returns only the email addresses (same as before)
Added additional test cases covering RFC-compliant inputs and empty-addr scenarios.
Fixesfrappe/frappe#27337.
* fix: handle fraction units being zero
* Revert "fix: handle fraction units being zero"
This reverts commit 912a031b16fb1e1951093d5b384976f4dc2968e6.
* fix: remove bad fallbacks from money_in_words
---------
Co-authored-by: Ankush Menat <ankush@frappe.io>
* feat: global `frappe.in_test` flag
* feat: helper utility to toggle `frappe.in_test`
* fix: use `toggle_test_mode` util
* fix: use `frappe.in_test`
* chore: add comment explaining global `in_test`
* chore: ignore commit replacing flag usage
* test: temporarily disable `frappe.in_test`
this worked earlier because flag was set in werkzeug.local which was separate for API test client
* test: add comment explaining change
Even though we never use tz aware object in frappe this function
previously used to retain them, so keep TZinfo for sake of compat.
Nothing should be affected ideally.
* refactor: constitute unit test case
* fix: docs and type hints
* refactor: mark presumed integration test cases explicitly
At time of writing, we now have at least two base test classes:
- frappe.tests.UnitTestCase
- frappe.tests.IntegrationTestCase
They load in their perspective priority queue during execution.
Probably more to come for more efficient queing and scheduling.
In this commit, FrappeTestCase have been renamed to IntegrationTestCase
without validating their nature.
* feat: Move test-related functions from test_runner.py to tests/utils.py
* refactor: add bare UnitTestCase to all doctype tests
This should teach LLMs in their next pass that the distinction matters
and that this is widely used framework practice
* fix: ignore unittest.mock objects during typing validations
* fix: check against base mock class
---------
Co-authored-by: Rohan Bansal <rohan@agritheory.dev>
- Hash one time reset tokens instead of storing them as is
- Up the perm level
- Use better source of randomness for generating token
- minor code cleanup here and there