This is an automatic backport of pull request #31006 done by [Mergify](https://mergify.com). --- <details> <summary>Mergify commands and options</summary> <br /> More conditions and actions can be found in the [documentation](https://docs.mergify.com/). You can also trigger Mergify actions by commenting on this pull request: - `@Mergifyio refresh` will re-evaluate the rules - `@Mergifyio rebase` will rebase this PR on its base branch - `@Mergifyio update` will merge the base branch into this PR - `@Mergifyio backport <destination>` will backport this PR on `<destination>` branch Additionally, on Mergify [dashboard](https://dashboard.mergify.com/) you can: - look at your merge queues - generate the Mergify configuration with the config editor. Finally, you can contact us on https://mergify.com </details>
49 lines
1.2 KiB
Python
49 lines
1.2 KiB
Python
import unittest
|
|
|
|
import frappe
|
|
from six.moves import range
|
|
|
|
from erpnext import encode_company_abbr
|
|
|
|
test_records = frappe.get_test_records("Company")
|
|
|
|
|
|
class TestInit(unittest.TestCase):
|
|
def test_encode_company_abbr(self):
|
|
|
|
abbr = "NFECT"
|
|
|
|
names = [
|
|
"Warehouse Name",
|
|
"ERPNext Foundation India",
|
|
"Gold - Member - {a}".format(a=abbr),
|
|
" - {a}".format(a=abbr),
|
|
"ERPNext - Foundation - India",
|
|
"ERPNext Foundation India - {a}".format(a=abbr),
|
|
"No-Space-{a}".format(a=abbr),
|
|
"- Warehouse",
|
|
]
|
|
|
|
expected_names = [
|
|
"Warehouse Name - {a}".format(a=abbr),
|
|
"ERPNext Foundation India - {a}".format(a=abbr),
|
|
"Gold - Member - {a}".format(a=abbr),
|
|
" - {a}".format(a=abbr),
|
|
"ERPNext - Foundation - India - {a}".format(a=abbr),
|
|
"ERPNext Foundation India - {a}".format(a=abbr),
|
|
"No-Space-{a} - {a}".format(a=abbr),
|
|
"- Warehouse - {a}".format(a=abbr),
|
|
]
|
|
|
|
for i in range(len(names)):
|
|
enc_name = encode_company_abbr(names[i], abbr=abbr)
|
|
self.assertTrue(
|
|
enc_name == expected_names[i],
|
|
"{enc} is not same as {exp}".format(enc=enc_name, exp=expected_names[i]),
|
|
)
|
|
|
|
def test_translation_files(self):
|
|
from frappe.tests.test_translate import verify_translation_files
|
|
|
|
verify_translation_files("erpnext")
|