* 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
19 lines
641 B
Python
19 lines
641 B
Python
import frappe
|
|
from frappe import format
|
|
from frappe.tests import IntegrationTestCase
|
|
|
|
|
|
class TestFormatter(IntegrationTestCase):
|
|
def test_currency_formatting(self):
|
|
df = frappe._dict({"fieldname": "amount", "fieldtype": "Currency", "options": "currency"})
|
|
|
|
doc = frappe._dict({"amount": 5})
|
|
frappe.db.set_default("currency", "INR")
|
|
|
|
# if currency field is not passed then default currency should be used.
|
|
self.assertEqual(format(100000, df, doc, format="#,###.##"), "₹ 100,000.00")
|
|
|
|
doc.currency = "USD"
|
|
self.assertEqual(format(100000, df, doc, format="#,###.##"), "$ 100,000.00")
|
|
|
|
frappe.db.set_default("currency", None)
|