test: parse full name
diff --git a/erpnext/selling/doctype/customer/test_customer.py b/erpnext/selling/doctype/customer/test_customer.py
index 6e737e4..29dbd4f 100644
--- a/erpnext/selling/doctype/customer/test_customer.py
+++ b/erpnext/selling/doctype/customer/test_customer.py
@@ -10,7 +10,11 @@
from erpnext.accounts.party import get_due_date
from erpnext.exceptions import PartyDisabled, PartyFrozen
-from erpnext.selling.doctype.customer.customer import get_credit_limit, get_customer_outstanding
+from erpnext.selling.doctype.customer.customer import (
+ get_credit_limit,
+ get_customer_outstanding,
+ parse_full_name,
+)
from erpnext.tests.utils import create_test_contact_and_address
test_ignore = ["Price List"]
@@ -373,6 +377,22 @@
frappe.db.set_single_value("Selling Settings", "cust_master_name", "Customer Name")
+ def test_parse_full_name(self):
+ first, middle, last = parse_full_name("John")
+ self.assertEqual(first, "John")
+ self.assertEqual(middle, None)
+ self.assertEqual(last, None)
+
+ first, middle, last = parse_full_name("John Doe")
+ self.assertEqual(first, "John")
+ self.assertEqual(middle, None)
+ self.assertEqual(last, "Doe")
+
+ first, middle, last = parse_full_name("John Michael Doe")
+ self.assertEqual(first, "John")
+ self.assertEqual(middle, "Michael")
+ self.assertEqual(last, "Doe")
+
def get_customer_dict(customer_name):
return {