Merge pull request #13137 from achillesrasquinha/py3

Fix unittest
This commit is contained in:
Achilles Rasquinha 2018-02-28 22:01:35 +05:30 committed by GitHub
commit 45522327b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
52 changed files with 585 additions and 585 deletions

View File

@ -19,5 +19,5 @@ class TestFiscalYear(unittest.TestCase):
"year_start_date": "2000-04-01"
})
fy.insert()
self.assertEquals(fy.year_end_date, '2001-03-31')
self.assertEqual(fy.year_end_date, '2001-03-31')

View File

@ -130,7 +130,7 @@ class TestJournalEntry(unittest.TestCase):
for field in ("account_currency", "debit", "debit_in_account_currency", "credit", "credit_in_account_currency"):
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_values[gle.account][field], gle[field])
self.assertEqual(expected_values[gle.account][field], gle[field])
# cancel
jv.cancel()

View File

@ -183,7 +183,7 @@ class TestPaymentEntry(unittest.TestCase):
pe.set_exchange_rate()
pe.set_amounts()
self.assertEquals(pe.difference_amount, 500)
self.assertEqual(pe.difference_amount, 500)
pe.append("deductions", {
"account": "_Test Exchange Gain/Loss - _TC",
@ -260,10 +260,10 @@ class TestPaymentEntry(unittest.TestCase):
self.assertTrue(gl_entries)
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_gle[gle.account][0], gle.account)
self.assertEquals(expected_gle[gle.account][1], gle.debit)
self.assertEquals(expected_gle[gle.account][2], gle.credit)
self.assertEquals(expected_gle[gle.account][3], gle.against_voucher)
self.assertEqual(expected_gle[gle.account][0], gle.account)
self.assertEqual(expected_gle[gle.account][1], gle.debit)
self.assertEqual(expected_gle[gle.account][2], gle.credit)
self.assertEqual(expected_gle[gle.account][3], gle.against_voucher)
def get_gle(self, voucher_no):
return frappe.db.sql("""select account, debit, credit, against_voucher

View File

@ -47,18 +47,18 @@ class TestPaymentRequest(unittest.TestCase):
so_inr = make_sales_order(currency="INR")
pr = make_payment_request(dt="Sales Order", dn=so_inr.name, recipient_id="saurabh@erpnext.com")
self.assertEquals(pr.reference_doctype, "Sales Order")
self.assertEquals(pr.reference_name, so_inr.name)
self.assertEquals(pr.currency, "INR")
self.assertEqual(pr.reference_doctype, "Sales Order")
self.assertEqual(pr.reference_name, so_inr.name)
self.assertEqual(pr.currency, "INR")
conversion_rate = get_exchange_rate("USD", "INR")
si_usd = create_sales_invoice(currency="USD", conversion_rate=conversion_rate)
pr = make_payment_request(dt="Sales Invoice", dn=si_usd.name, recipient_id="saurabh@erpnext.com")
self.assertEquals(pr.reference_doctype, "Sales Invoice")
self.assertEquals(pr.reference_name, si_usd.name)
self.assertEquals(pr.currency, "USD")
self.assertEqual(pr.reference_doctype, "Sales Invoice")
self.assertEqual(pr.reference_name, si_usd.name)
self.assertEqual(pr.currency, "USD")
def test_payment_entry(self):
frappe.db.set_value("Company", "_Test Company",
@ -75,7 +75,7 @@ class TestPaymentRequest(unittest.TestCase):
so_inr = frappe.get_doc("Sales Order", so_inr.name)
self.assertEquals(so_inr.advance_paid, 1000)
self.assertEqual(so_inr.advance_paid, 1000)
si_usd = create_sales_invoice(customer="_Test Customer USD", debit_to="_Test Receivable USD - _TC",
currency="USD", conversion_rate=50)
@ -98,7 +98,7 @@ class TestPaymentRequest(unittest.TestCase):
self.assertTrue(gl_entries)
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_gle[gle.account][0], gle.account)
self.assertEquals(expected_gle[gle.account][1], gle.debit)
self.assertEquals(expected_gle[gle.account][2], gle.credit)
self.assertEquals(expected_gle[gle.account][3], gle.against_voucher)
self.assertEqual(expected_gle[gle.account][0], gle.account)
self.assertEqual(expected_gle[gle.account][1], gle.debit)
self.assertEqual(expected_gle[gle.account][2], gle.credit)
self.assertEqual(expected_gle[gle.account][3], gle.against_voucher)

View File

@ -25,8 +25,8 @@ class TestPOSProfile(unittest.TestCase):
products_count = frappe.db.sql(""" select count(name) from tabItem where item_group = '_Test Item Group'""", as_list=1)
customers_count = frappe.db.sql(""" select count(name) from tabCustomer where customer_group = '_Test Customer Group'""")
self.assertEquals(len(items), products_count[0][0])
self.assertEquals(len(customers), customers_count[0][0])
self.assertEqual(len(items), products_count[0][0])
self.assertEqual(len(customers), customers_count[0][0])
frappe.db.sql("delete from `tabPOS Profile`")

View File

@ -45,7 +45,7 @@ class TestPricingRule(unittest.TestCase):
"name": None
})
details = get_item_details(args)
self.assertEquals(details.get("discount_percentage"), 10)
self.assertEqual(details.get("discount_percentage"), 10)
prule = frappe.get_doc(test_record.copy())
prule.applicable_for = "Customer"
@ -56,7 +56,7 @@ class TestPricingRule(unittest.TestCase):
prule.discount_percentage = 20
prule.insert()
details = get_item_details(args)
self.assertEquals(details.get("discount_percentage"), 20)
self.assertEqual(details.get("discount_percentage"), 20)
prule = frappe.get_doc(test_record.copy())
prule.apply_on = "Item Group"
@ -67,7 +67,7 @@ class TestPricingRule(unittest.TestCase):
args.customer = "_Test Customer 1"
details = get_item_details(args)
self.assertEquals(details.get("discount_percentage"), 10)
self.assertEqual(details.get("discount_percentage"), 10)
prule = frappe.get_doc(test_record.copy())
prule.applicable_for = "Campaign"
@ -79,7 +79,7 @@ class TestPricingRule(unittest.TestCase):
args.campaign = "_Test Campaign"
details = get_item_details(args)
self.assertEquals(details.get("discount_percentage"), 5)
self.assertEqual(details.get("discount_percentage"), 5)
frappe.db.sql("update `tabPricing Rule` set priority=NULL where campaign='_Test Campaign'")
from erpnext.accounts.doctype.pricing_rule.pricing_rule import MultiplePricingRuleConflict
@ -87,7 +87,7 @@ class TestPricingRule(unittest.TestCase):
args.item_code = "_Test Item 2"
details = get_item_details(args)
self.assertEquals(details.get("discount_percentage"), 15)
self.assertEqual(details.get("discount_percentage"), 15)
frappe.db.sql("delete from `tabPricing Rule`")
@ -135,8 +135,8 @@ class TestPricingRule(unittest.TestCase):
"name": None
})
details = get_item_details(args)
self.assertEquals(details.get("margin_type"), "Percentage")
self.assertEquals(details.get("margin_rate_or_amount"), 10)
self.assertEqual(details.get("margin_type"), "Percentage")
self.assertEqual(details.get("margin_rate_or_amount"), 10)
frappe.db.sql("delete from `tabPricing Rule`")
@ -193,7 +193,7 @@ class TestPricingRule(unittest.TestCase):
})
details = get_item_details(args)
self.assertEquals(details.get("discount_percentage"), 7.5)
self.assertEqual(details.get("discount_percentage"), 7.5)
# add a new pricing rule for that item code, it should take priority
frappe.get_doc({
@ -210,7 +210,7 @@ class TestPricingRule(unittest.TestCase):
}).insert()
details = get_item_details(args)
self.assertEquals(details.get("discount_percentage"), 17.5)
self.assertEqual(details.get("discount_percentage"), 17.5)
def test_pricing_rule_for_stock_qty(self):
frappe.db.sql("delete from `tabPricing Rule`")
@ -245,16 +245,16 @@ class TestPricingRule(unittest.TestCase):
so.items[0].price_list_rate = 100
so.submit()
so = frappe.get_doc('Sales Order', so.name)
self.assertEquals(so.items[0].discount_percentage, 17.5)
self.assertEquals(so.items[0].rate, 82.5)
self.assertEqual(so.items[0].discount_percentage, 17.5)
self.assertEqual(so.items[0].rate, 82.5)
# Without pricing rule
so = make_sales_order(item_code="_Test Item", qty=2, uom="Box", do_not_submit=True)
so.items[0].price_list_rate = 100
so.submit()
so = frappe.get_doc('Sales Order', so.name)
self.assertEquals(so.items[0].discount_percentage, 0)
self.assertEquals(so.items[0].rate, 100)
self.assertEqual(so.items[0].discount_percentage, 0)
self.assertEqual(so.items[0].rate, 100)
def test_pricing_rule_with_margin_and_discount(self):
frappe.delete_doc_if_exists('Pricing Rule', '_Test Pricing Rule')
@ -265,16 +265,16 @@ class TestPricingRule(unittest.TestCase):
si.insert(ignore_permissions=True)
item = si.items[0]
self.assertEquals(item.rate, 1100)
self.assertEquals(item.margin_rate_or_amount, 10)
self.assertEqual(item.rate, 1100)
self.assertEqual(item.margin_rate_or_amount, 10)
# With discount
item.discount_percentage = 10
si.payment_schedule = []
si.save()
item = si.items[0]
self.assertEquals(item.rate, 990)
self.assertEquals(item.discount_percentage, 10)
self.assertEqual(item.rate, 990)
self.assertEqual(item.discount_percentage, 10)
frappe.db.sql("delete from `tabPricing Rule`")
def make_pricing_rule(**args):

View File

@ -121,9 +121,9 @@ class TestPurchaseInvoice(unittest.TestCase):
])
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_values[gle.account][0], gle.account)
self.assertEquals(expected_values[gle.account][1], gle.debit)
self.assertEquals(expected_values[gle.account][2], gle.credit)
self.assertEqual(expected_values[gle.account][0], gle.account)
self.assertEqual(expected_values[gle.account][1], gle.debit)
self.assertEqual(expected_values[gle.account][2], gle.credit)
def test_purchase_invoice_change_naming_series(self):
pi = frappe.copy_doc(test_records[1])
@ -161,9 +161,9 @@ class TestPurchaseInvoice(unittest.TestCase):
])
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_values[i][0], gle.account)
self.assertEquals(expected_values[i][1], gle.debit)
self.assertEquals(expected_values[i][2], gle.credit)
self.assertEqual(expected_values[i][0], gle.account)
self.assertEqual(expected_values[i][1], gle.debit)
self.assertEqual(expected_values[i][2], gle.credit)
set_perpetual_inventory(0, pi.company)
def test_purchase_invoice_calculation(self):
@ -363,8 +363,8 @@ class TestPurchaseInvoice(unittest.TestCase):
}
for gle in gl_entries:
self.assertEquals(expected_values[gle.account][0], gle.debit)
self.assertEquals(expected_values[gle.account][1], gle.credit)
self.assertEqual(expected_values[gle.account][0], gle.debit)
self.assertEqual(expected_values[gle.account][1], gle.credit)
set_perpetual_inventory(0)
@ -400,7 +400,7 @@ class TestPurchaseInvoice(unittest.TestCase):
for field in ("account_currency", "debit", "debit_in_account_currency", "credit", "credit_in_account_currency"):
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_values[gle.account][field], gle[field])
self.assertEqual(expected_values[gle.account][field], gle[field])
# Check for valid currency
@ -437,9 +437,9 @@ class TestPurchaseInvoice(unittest.TestCase):
])
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_gl_entries[gle.account][0], gle.account)
self.assertEquals(expected_gl_entries[gle.account][1], gle.debit)
self.assertEquals(expected_gl_entries[gle.account][2], gle.credit)
self.assertEqual(expected_gl_entries[gle.account][0], gle.account)
self.assertEqual(expected_gl_entries[gle.account][1], gle.debit)
self.assertEqual(expected_gl_entries[gle.account][2], gle.credit)
def test_purchase_invoice_for_is_paid_and_update_stock_gl_entry_with_perpetual_inventory(self):
set_perpetual_inventory()
@ -461,9 +461,9 @@ class TestPurchaseInvoice(unittest.TestCase):
])
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_gl_entries[gle.account][0], gle.account)
self.assertEquals(expected_gl_entries[gle.account][1], gle.debit)
self.assertEquals(expected_gl_entries[gle.account][2], gle.credit)
self.assertEqual(expected_gl_entries[gle.account][0], gle.account)
self.assertEqual(expected_gl_entries[gle.account][1], gle.debit)
self.assertEqual(expected_gl_entries[gle.account][2], gle.credit)
def test_auto_batch(self):
item_code = frappe.db.get_value('Item',
@ -493,20 +493,20 @@ class TestPurchaseInvoice(unittest.TestCase):
posting_time=frappe.utils.nowtime())
actual_qty_1 = get_qty_after_transaction()
self.assertEquals(actual_qty_0 + 5, actual_qty_1)
self.assertEqual(actual_qty_0 + 5, actual_qty_1)
# return entry
pi1 = make_purchase_invoice(is_return=1, return_against=pi.name, qty=-2, rate=50, update_stock=1)
actual_qty_2 = get_qty_after_transaction()
self.assertEquals(actual_qty_1 - 2, actual_qty_2)
self.assertEqual(actual_qty_1 - 2, actual_qty_2)
pi1.cancel()
self.assertEquals(actual_qty_1, get_qty_after_transaction())
self.assertEqual(actual_qty_1, get_qty_after_transaction())
pi.reload()
pi.cancel()
self.assertEquals(actual_qty_0, get_qty_after_transaction())
self.assertEqual(actual_qty_0, get_qty_after_transaction())
def test_subcontracting_via_purchase_invoice(self):
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
@ -518,20 +518,20 @@ class TestPurchaseInvoice(unittest.TestCase):
pi = make_purchase_invoice(item_code="_Test FG Item", qty=10, rate=500,
update_stock=1, is_subcontracted="Yes")
self.assertEquals(len(pi.get("supplied_items")), 2)
self.assertEqual(len(pi.get("supplied_items")), 2)
rm_supp_cost = sum([d.amount for d in pi.get("supplied_items")])
self.assertEquals(pi.get("items")[0].rm_supp_cost, flt(rm_supp_cost, 2))
self.assertEqual(pi.get("items")[0].rm_supp_cost, flt(rm_supp_cost, 2))
def test_rejected_serial_no(self):
pi = make_purchase_invoice(item_code="_Test Serialized Item With Series", received_qty=2, qty=1,
rejected_qty=1, rate=500, update_stock=1,
rejected_warehouse = "_Test Rejected Warehouse - _TC")
self.assertEquals(frappe.db.get_value("Serial No", pi.get("items")[0].serial_no, "warehouse"),
self.assertEqual(frappe.db.get_value("Serial No", pi.get("items")[0].serial_no, "warehouse"),
pi.get("items")[0].warehouse)
self.assertEquals(frappe.db.get_value("Serial No", pi.get("items")[0].rejected_serial_no,
self.assertEqual(frappe.db.get_value("Serial No", pi.get("items")[0].rejected_serial_no,
"warehouse"), pi.get("items")[0].rejected_warehouse)
def test_outstanding_amount_after_advance_jv_cancelation(self):
@ -643,10 +643,10 @@ class TestPurchaseInvoice(unittest.TestCase):
pi.append("taxes", shipping_charge)
pi.save()
self.assertEquals(pi.net_total, 1250)
self.assertEqual(pi.net_total, 1250)
self.assertEquals(pi.total_taxes_and_charges, 462.3)
self.assertEquals(pi.grand_total, 1712.3)
self.assertEqual(pi.total_taxes_and_charges, 462.3)
self.assertEqual(pi.grand_total, 1712.3)
def test_make_pi_without_terms(self):
pi = make_purchase_invoice(do_not_save=1)

View File

@ -78,17 +78,17 @@ class TestSalesInvoice(unittest.TestCase):
}
# check if children are saved
self.assertEquals(len(si.get("items")),
self.assertEqual(len(si.get("items")),
len(expected_values)-1)
# check if item values are calculated
for d in si.get("items"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.item_code][i])
self.assertEqual(d.get(k), expected_values[d.item_code][i])
# check net total
self.assertEquals(si.base_net_total, 1250)
self.assertEquals(si.net_total, 1250)
self.assertEqual(si.base_net_total, 1250)
self.assertEqual(si.net_total, 1250)
# check tax calculation
expected_values = {
@ -105,10 +105,10 @@ class TestSalesInvoice(unittest.TestCase):
for d in si.get("taxes"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.account_head][i])
self.assertEqual(d.get(k), expected_values[d.account_head][i])
self.assertEquals(si.base_grand_total, 1627.05)
self.assertEquals(si.grand_total, 1627.05)
self.assertEqual(si.base_grand_total, 1627.05)
self.assertEqual(si.grand_total, 1627.05)
def test_payment_entry_unlink_against_invoice(self):
from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry
@ -153,18 +153,18 @@ class TestSalesInvoice(unittest.TestCase):
}
# check if children are saved
self.assertEquals(len(si.get("items")), len(expected_values)-1)
self.assertEqual(len(si.get("items")), len(expected_values)-1)
# check if item values are calculated
for d in si.get("items"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.item_code][i])
self.assertEqual(d.get(k), expected_values[d.item_code][i])
# check net total
self.assertEquals(si.total, 25)
self.assertEquals(si.base_total, 1250)
self.assertEquals(si.net_total, 25)
self.assertEquals(si.base_net_total, 1250)
self.assertEqual(si.total, 25)
self.assertEqual(si.base_total, 1250)
self.assertEqual(si.net_total, 25)
self.assertEqual(si.base_net_total, 1250)
# check tax calculation
expected_values = {
@ -181,10 +181,10 @@ class TestSalesInvoice(unittest.TestCase):
for d in si.get("taxes"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.account_head][i])
self.assertEqual(d.get(k), expected_values[d.account_head][i])
self.assertEquals(si.base_grand_total, 1627.5)
self.assertEquals(si.grand_total, 32.55)
self.assertEqual(si.base_grand_total, 1627.5)
self.assertEqual(si.grand_total, 32.55)
def test_sales_invoice_with_discount_and_inclusive_tax(self):
si = create_sales_invoice(qty=100, rate=50, do_not_save=True)
@ -199,8 +199,8 @@ class TestSalesInvoice(unittest.TestCase):
si.insert()
# with inclusive tax
self.assertEquals(si.net_total, 4385.96)
self.assertEquals(si.grand_total, 5000)
self.assertEqual(si.net_total, 4385.96)
self.assertEqual(si.grand_total, 5000)
si.reload()
@ -212,8 +212,8 @@ class TestSalesInvoice(unittest.TestCase):
si.save()
# with inclusive tax and additional discount
self.assertEquals(si.net_total, 4285.96)
self.assertEquals(si.grand_total, 4885.99)
self.assertEqual(si.net_total, 4285.96)
self.assertEqual(si.grand_total, 4885.99)
si.reload()
@ -225,8 +225,8 @@ class TestSalesInvoice(unittest.TestCase):
si.save()
# with inclusive tax and additional discount
self.assertEquals(si.net_total, 4298.25)
self.assertEquals(si.grand_total, 4900.00)
self.assertEqual(si.net_total, 4298.25)
self.assertEqual(si.grand_total, 4900.00)
def test_sales_invoice_discount_amount(self):
si = frappe.copy_doc(test_records[3])
@ -273,16 +273,16 @@ class TestSalesInvoice(unittest.TestCase):
]
# check if children are saved
self.assertEquals(len(si.get("items")), len(expected_values))
self.assertEqual(len(si.get("items")), len(expected_values))
# check if item values are calculated
for i, d in enumerate(si.get("items")):
for k, v in expected_values[i].items():
self.assertEquals(d.get(k), v)
self.assertEqual(d.get(k), v)
# check net total
self.assertEquals(si.base_net_total, 1163.45)
self.assertEquals(si.total, 1578.3)
self.assertEqual(si.base_net_total, 1163.45)
self.assertEqual(si.total, 1578.3)
# check tax calculation
expected_values = {
@ -300,11 +300,11 @@ class TestSalesInvoice(unittest.TestCase):
for d in si.get("taxes"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.account_head][i])
self.assertEqual(d.get(k), expected_values[d.account_head][i])
self.assertEquals(si.base_grand_total, 1500)
self.assertEquals(si.grand_total, 1500)
self.assertEquals(si.rounding_adjustment, -0.01)
self.assertEqual(si.base_grand_total, 1500)
self.assertEqual(si.grand_total, 1500)
self.assertEqual(si.rounding_adjustment, -0.01)
def test_discount_amount_gl_entry(self):
frappe.db.set_value("Company", "_Test Company", "round_off_account", "Round Off - _TC")
@ -344,9 +344,9 @@ class TestSalesInvoice(unittest.TestCase):
])
for gle in gl_entries:
self.assertEquals(expected_values[gle.account][0], gle.account)
self.assertEquals(expected_values[gle.account][1], gle.debit)
self.assertEquals(expected_values[gle.account][2], gle.credit)
self.assertEqual(expected_values[gle.account][0], gle.account)
self.assertEqual(expected_values[gle.account][1], gle.debit)
self.assertEqual(expected_values[gle.account][2], gle.credit)
# cancel
si.cancel()
@ -374,12 +374,12 @@ class TestSalesInvoice(unittest.TestCase):
})
si.insert()
self.assertEquals(si.net_total, 4600)
self.assertEqual(si.net_total, 4600)
self.assertEquals(si.get("taxes")[0].tax_amount, 874.0)
self.assertEquals(si.get("taxes")[0].total, 5474.0)
self.assertEqual(si.get("taxes")[0].tax_amount, 874.0)
self.assertEqual(si.get("taxes")[0].total, 5474.0)
self.assertEquals(si.grand_total, 5474.0)
self.assertEqual(si.grand_total, 5474.0)
def test_tax_calculation_with_multiple_items_and_discount(self):
si = create_sales_invoice(qty=1, rate=75, do_not_save=True)
@ -403,13 +403,13 @@ class TestSalesInvoice(unittest.TestCase):
})
si.insert()
self.assertEquals(si.total, 975)
self.assertEquals(si.net_total, 900)
self.assertEqual(si.total, 975)
self.assertEqual(si.net_total, 900)
self.assertEquals(si.get("taxes")[0].tax_amount, 216.0)
self.assertEquals(si.get("taxes")[0].total, 1116.0)
self.assertEqual(si.get("taxes")[0].tax_amount, 216.0)
self.assertEqual(si.get("taxes")[0].total, 1116.0)
self.assertEquals(si.grand_total, 1116.0)
self.assertEqual(si.grand_total, 1116.0)
def test_inclusive_rate_validations(self):
si = frappe.copy_doc(test_records[2])
@ -441,16 +441,16 @@ class TestSalesInvoice(unittest.TestCase):
}
# check if children are saved
self.assertEquals(len(si.get("items")), len(expected_values)-1)
self.assertEqual(len(si.get("items")), len(expected_values)-1)
# check if item values are calculated
for d in si.get("items"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.item_code][i])
self.assertEqual(d.get(k), expected_values[d.item_code][i])
# check net total
self.assertEquals(si.net_total, 1249.97)
self.assertEquals(si.total, 1578.3)
self.assertEqual(si.net_total, 1249.97)
self.assertEqual(si.total, 1578.3)
# check tax calculation
expected_values = {
@ -467,10 +467,10 @@ class TestSalesInvoice(unittest.TestCase):
for d in si.get("taxes"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.account_head][i])
self.assertEqual(d.get(k), expected_values[d.account_head][i])
self.assertEquals(si.base_grand_total, 1622.97)
self.assertEquals(si.grand_total, 1622.97)
self.assertEqual(si.base_grand_total, 1622.97)
self.assertEqual(si.grand_total, 1622.97)
def test_sales_invoice_calculation_export_currency_with_tax_inclusive_price(self):
# prepare
@ -519,17 +519,17 @@ class TestSalesInvoice(unittest.TestCase):
]
# check if children are saved
self.assertEquals(len(si.get("items")), len(expected_values))
self.assertEqual(len(si.get("items")), len(expected_values))
# check if item values are calculated
for i, d in enumerate(si.get("items")):
for key, val in expected_values[i].items():
self.assertEquals(d.get(key), val)
self.assertEqual(d.get(key), val)
# check net total
self.assertEquals(si.base_net_total, 49501.5)
self.assertEquals(si.net_total, 990.03)
self.assertEquals(si.total, 1250)
self.assertEqual(si.base_net_total, 49501.5)
self.assertEqual(si.net_total, 990.03)
self.assertEqual(si.total, 1250)
# check tax calculation
expected_values = {
@ -546,17 +546,17 @@ class TestSalesInvoice(unittest.TestCase):
for d in si.get("taxes"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.account_head][i])
self.assertEqual(d.get(k), expected_values[d.account_head][i])
self.assertEquals(si.base_grand_total, 60795)
self.assertEquals(si.grand_total, 1215.90)
self.assertEquals(si.rounding_adjustment, 0.01)
self.assertEquals(si.base_rounding_adjustment, 0.50)
self.assertEqual(si.base_grand_total, 60795)
self.assertEqual(si.grand_total, 1215.90)
self.assertEqual(si.rounding_adjustment, 0.01)
self.assertEqual(si.base_rounding_adjustment, 0.50)
def test_outstanding(self):
w = self.make()
self.assertEquals(w.outstanding_amount, w.base_rounded_total)
self.assertEqual(w.outstanding_amount, w.base_rounded_total)
def test_payment(self):
w = self.make()
@ -570,7 +570,7 @@ class TestSalesInvoice(unittest.TestCase):
jv.insert()
jv.submit()
self.assertEquals(frappe.db.get_value("Sales Invoice", w.name, "outstanding_amount"), 162.0)
self.assertEqual(frappe.db.get_value("Sales Invoice", w.name, "outstanding_amount"), 162.0)
link_data = get_dynamic_link_map().get('Sales Invoice', [])
link_doctypes = [d.parent for d in link_data]
@ -579,7 +579,7 @@ class TestSalesInvoice(unittest.TestCase):
self.assertTrue(link_doctypes.index('GL Entry') > link_doctypes.index('Journal Entry Account'))
jv.cancel()
self.assertEquals(frappe.db.get_value("Sales Invoice", w.name, "outstanding_amount"), 562.0)
self.assertEqual(frappe.db.get_value("Sales Invoice", w.name, "outstanding_amount"), 562.0)
def test_sales_invoice_gl_entry_without_perpetual_inventory(self):
si = frappe.copy_doc(test_records[1])
@ -601,9 +601,9 @@ class TestSalesInvoice(unittest.TestCase):
])
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_values[gle.account][0], gle.account)
self.assertEquals(expected_values[gle.account][1], gle.debit)
self.assertEquals(expected_values[gle.account][2], gle.credit)
self.assertEqual(expected_values[gle.account][0], gle.account)
self.assertEqual(expected_values[gle.account][1], gle.debit)
self.assertEqual(expected_values[gle.account][2], gle.credit)
# cancel
si.cancel()
@ -628,7 +628,7 @@ class TestSalesInvoice(unittest.TestCase):
si.insert()
si.submit()
self.assertEquals(si.paid_amount, 600.0)
self.assertEqual(si.paid_amount, 600.0)
self.pos_gl_entry(si, pos, 300)
@ -648,8 +648,8 @@ class TestSalesInvoice(unittest.TestCase):
si.insert()
si.submit()
self.assertEquals(si.grand_total, 630.0)
self.assertEquals(si.write_off_amount, -5)
self.assertEqual(si.grand_total, 630.0)
self.assertEqual(si.write_off_amount, -5)
def test_make_pos_invoice(self):
from erpnext.accounts.doctype.sales_invoice.pos import make_invoice
@ -667,11 +667,11 @@ class TestSalesInvoice(unittest.TestCase):
invoice_data = [{'09052016142': pos}]
si = make_invoice(invoice_data).get('invoice')
self.assertEquals(si[0], '09052016142')
self.assertEqual(si[0], '09052016142')
sales_invoice = frappe.get_all('Sales Invoice', fields =["*"], filters = {'offline_pos_name': '09052016142', 'docstatus': 1})
si = frappe.get_doc('Sales Invoice', sales_invoice[0].name)
self.assertEquals(si.grand_total, 630.0)
self.assertEqual(si.grand_total, 630.0)
self.pos_gl_entry(si, pos, 330)
@ -699,19 +699,19 @@ class TestSalesInvoice(unittest.TestCase):
invoice_data = [{timestamp: pos}]
si = make_invoice(invoice_data).get('invoice')
self.assertEquals(si[0], timestamp)
self.assertEqual(si[0], timestamp)
sales_invoice = frappe.get_all('Sales Invoice', fields =["*"], filters = {'offline_pos_name': timestamp})
self.assertEquals(sales_invoice[0].docstatus, 0)
self.assertEqual(sales_invoice[0].docstatus, 0)
timestamp = cint(time.time())
pos["offline_pos_name"] = timestamp
invoice_data = [{timestamp: pos}]
si1 = make_invoice(invoice_data).get('invoice')
self.assertEquals(si1[0], timestamp)
self.assertEqual(si1[0], timestamp)
sales_invoice1 = frappe.get_all('Sales Invoice', fields =["*"], filters = {'offline_pos_name': timestamp})
self.assertEquals(sales_invoice1[0].docstatus, 0)
self.assertEqual(sales_invoice1[0].docstatus, 0)
if allow_negative_stock:
frappe.db.set_value('Stock Settings', None, 'allow_negative_stock', 1)
@ -722,7 +722,7 @@ class TestSalesInvoice(unittest.TestCase):
where voucher_type = 'Sales Invoice' and voucher_no = %s""",
si.name, as_dict=1)[0]
self.assertTrue(sle)
self.assertEquals([sle.item_code, sle.warehouse, sle.actual_qty],
self.assertEqual([sle.item_code, sle.warehouse, sle.actual_qty],
["_Test Item", "_Test Warehouse - _TC", -1.0])
# check gl entries
@ -747,9 +747,9 @@ class TestSalesInvoice(unittest.TestCase):
])
for i, gle in enumerate(sorted(gl_entries, key=lambda gle: gle.account)):
self.assertEquals(expected_gl_entries[i][0], gle.account)
self.assertEquals(expected_gl_entries[i][1], gle.debit)
self.assertEquals(expected_gl_entries[i][2], gle.credit)
self.assertEqual(expected_gl_entries[i][0], gle.account)
self.assertEqual(expected_gl_entries[i][1], gle.debit)
self.assertEqual(expected_gl_entries[i][2], gle.credit)
si.cancel()
frappe.delete_doc('Sales Invoice', si.name)
@ -782,9 +782,9 @@ class TestSalesInvoice(unittest.TestCase):
[test_records[1]["taxes"][1]["account_head"], 0.0, 50.0],
])
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_values[gle.account][0], gle.account)
self.assertEquals(expected_values[gle.account][1], gle.debit)
self.assertEquals(expected_values[gle.account][2], gle.credit)
self.assertEqual(expected_values[gle.account][0], gle.account)
self.assertEqual(expected_values[gle.account][1], gle.debit)
self.assertEqual(expected_values[gle.account][2], gle.credit)
set_perpetual_inventory(0)
@ -807,9 +807,9 @@ class TestSalesInvoice(unittest.TestCase):
[test_records[1]["taxes"][1]["account_head"], 0.0, 50.0],
])
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_values[gle.account][0], gle.account)
self.assertEquals(expected_values[gle.account][1], gle.debit)
self.assertEquals(expected_values[gle.account][2], gle.credit)
self.assertEqual(expected_values[gle.account][0], gle.account)
self.assertEqual(expected_values[gle.account][1], gle.debit)
self.assertEqual(expected_values[gle.account][2], gle.credit)
set_perpetual_inventory(0)
@ -881,9 +881,9 @@ class TestSalesInvoice(unittest.TestCase):
si.submit()
self.assertFalse(frappe.db.get_value("Serial No", serial_nos[0], "warehouse"))
self.assertEquals(frappe.db.get_value("Serial No", serial_nos[0],
self.assertEqual(frappe.db.get_value("Serial No", serial_nos[0],
"delivery_document_no"), si.name)
self.assertEquals(frappe.db.get_value("Serial No", serial_nos[0], "sales_invoice"),
self.assertEqual(frappe.db.get_value("Serial No", serial_nos[0], "sales_invoice"),
si.name)
# check if the serial number is already linked with any other Sales Invoice
@ -899,7 +899,7 @@ class TestSalesInvoice(unittest.TestCase):
serial_nos = get_serial_nos(si.get("items")[0].serial_no)
self.assertEquals(frappe.db.get_value("Serial No", serial_nos[0], "warehouse"), "_Test Warehouse - _TC")
self.assertEqual(frappe.db.get_value("Serial No", serial_nos[0], "warehouse"), "_Test Warehouse - _TC")
self.assertFalse(frappe.db.get_value("Serial No", serial_nos[0],
"delivery_document_no"))
self.assertFalse(frappe.db.get_value("Serial No", serial_nos[0], "sales_invoice"))
@ -940,7 +940,7 @@ class TestSalesInvoice(unittest.TestCase):
si = make_sales_invoice(dn.name)
si.save()
self.assertEquals(si.get("items")[0].serial_no, dn.get("items")[0].serial_no)
self.assertEqual(si.get("items")[0].serial_no, dn.get("items")[0].serial_no)
def test_return_sales_invoice(self):
set_perpetual_inventory()
@ -951,7 +951,7 @@ class TestSalesInvoice(unittest.TestCase):
si = create_sales_invoice(qty=5, rate=500, update_stock=1)
actual_qty_1 = get_qty_after_transaction()
self.assertEquals(actual_qty_0 - 5, actual_qty_1)
self.assertEqual(actual_qty_0 - 5, actual_qty_1)
# outgoing_rate
outgoing_rate = frappe.db.get_value("Stock Ledger Entry", {"voucher_type": "Sales Invoice",
@ -962,20 +962,20 @@ class TestSalesInvoice(unittest.TestCase):
actual_qty_2 = get_qty_after_transaction()
self.assertEquals(actual_qty_1 + 2, actual_qty_2)
self.assertEqual(actual_qty_1 + 2, actual_qty_2)
incoming_rate, stock_value_difference = frappe.db.get_value("Stock Ledger Entry",
{"voucher_type": "Sales Invoice", "voucher_no": si1.name},
["incoming_rate", "stock_value_difference"])
self.assertEquals(flt(incoming_rate, 3), abs(flt(outgoing_rate, 3)))
self.assertEqual(flt(incoming_rate, 3), abs(flt(outgoing_rate, 3)))
stock_in_hand_account = get_inventory_account('_Test Company', si1.items[0].warehouse)
# Check gl entry
gle_warehouse_amount = frappe.db.get_value("GL Entry", {"voucher_type": "Sales Invoice",
"voucher_no": si1.name, "account": stock_in_hand_account}, "debit")
self.assertEquals(gle_warehouse_amount, stock_value_difference)
self.assertEqual(gle_warehouse_amount, stock_value_difference)
party_credited = frappe.db.get_value("GL Entry", {"voucher_type": "Sales Invoice",
"voucher_no": si1.name, "account": "Debtors - _TC", "party": "_Test Customer"}, "credit")
@ -1003,19 +1003,19 @@ class TestSalesInvoice(unittest.TestCase):
}
# check if children are saved
self.assertEquals(len(si.get("items")),
self.assertEqual(len(si.get("items")),
len(expected_values)-1)
# check if item values are calculated
for d in si.get("items"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.item_code][i])
self.assertEqual(d.get(k), expected_values[d.item_code][i])
# check net total
self.assertEquals(si.base_total, 1250)
self.assertEquals(si.total, 1250)
self.assertEquals(si.base_net_total, 625)
self.assertEquals(si.net_total, 625)
self.assertEqual(si.base_total, 1250)
self.assertEqual(si.total, 1250)
self.assertEqual(si.base_net_total, 625)
self.assertEqual(si.net_total, 625)
# check tax calculation
expected_values = {
@ -1034,12 +1034,12 @@ class TestSalesInvoice(unittest.TestCase):
for d in si.get("taxes"):
for i, k in enumerate(expected_values["keys"]):
if expected_values.get(d.account_head):
self.assertEquals(d.get(k), expected_values[d.account_head][i])
self.assertEqual(d.get(k), expected_values[d.account_head][i])
self.assertEquals(si.total_taxes_and_charges, 234.43)
self.assertEquals(si.base_grand_total, 859.43)
self.assertEquals(si.grand_total, 859.43)
self.assertEqual(si.total_taxes_and_charges, 234.43)
self.assertEqual(si.base_grand_total, 859.43)
self.assertEqual(si.grand_total, 859.43)
def test_multi_currency_gle(self):
set_perpetual_inventory(0)
@ -1072,7 +1072,7 @@ class TestSalesInvoice(unittest.TestCase):
for field in ("account_currency", "debit", "debit_in_account_currency", "credit", "credit_in_account_currency"):
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_values[gle.account][field], gle[field])
self.assertEqual(expected_values[gle.account][field], gle[field])
# cancel
si.cancel()
@ -1233,7 +1233,7 @@ class TestSalesInvoice(unittest.TestCase):
# check if the conversion_factor and price_list_rate is calculated according to uom
for d in si.get("items"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.item_code][i])
self.assertEqual(d.get(k), expected_values[d.item_code][i])
def test_item_wise_tax_breakup_india(self):
frappe.flags.country = "India"
@ -1363,9 +1363,9 @@ class TestSalesInvoice(unittest.TestCase):
order by account asc""", si.name, as_dict=1)
for gle in gl_entries:
self.assertEquals(expected_values[gle.account][0], gle.account)
self.assertEquals(expected_values[gle.account][1], gle.debit)
self.assertEquals(expected_values[gle.account][2], gle.credit)
self.assertEqual(expected_values[gle.account][0], gle.account)
self.assertEqual(expected_values[gle.account][1], gle.debit)
self.assertEqual(expected_values[gle.account][2], gle.credit)
def test_sales_invoice_with_shipping_rule(self):
from erpnext.accounts.doctype.shipping_rule.test_shipping_rule \
@ -1395,10 +1395,10 @@ class TestSalesInvoice(unittest.TestCase):
si.append("taxes", shipping_charge)
si.save()
self.assertEquals(si.net_total, 1250)
self.assertEqual(si.net_total, 1250)
self.assertEquals(si.total_taxes_and_charges, 577.05)
self.assertEquals(si.grand_total, 1827.05)
self.assertEqual(si.total_taxes_and_charges, 577.05)
self.assertEqual(si.grand_total, 1827.05)
def test_create_invoice_without_terms(self):
si = create_sales_invoice(do_not_save=1)

View File

@ -18,12 +18,12 @@ class TestSubscription(unittest.TestCase):
qo.submit()
doc = make_subscription(reference_document=qo.name)
self.assertEquals(doc.next_schedule_date, today())
self.assertEqual(doc.next_schedule_date, today())
make_subscription_entry()
frappe.db.commit()
quotation = frappe.get_doc(doc.reference_doctype, doc.reference_document)
self.assertEquals(quotation.subscription, doc.name)
self.assertEqual(quotation.subscription, doc.name)
new_quotation = frappe.db.get_value('Quotation',
{'subscription': doc.name, 'name': ('!=', quotation.name)}, 'name')
@ -31,10 +31,10 @@ class TestSubscription(unittest.TestCase):
new_quotation = frappe.get_doc('Quotation', new_quotation)
for fieldname in ['customer', 'company', 'order_type', 'total', 'net_total']:
self.assertEquals(quotation.get(fieldname), new_quotation.get(fieldname))
self.assertEqual(quotation.get(fieldname), new_quotation.get(fieldname))
for fieldname in ['item_code', 'qty', 'rate', 'amount']:
self.assertEquals(quotation.items[0].get(fieldname),
self.assertEqual(quotation.items[0].get(fieldname),
new_quotation.items[0].get(fieldname))
def test_monthly_subscription_for_so(self):
@ -60,7 +60,7 @@ class TestSubscription(unittest.TestCase):
make_subscription_entry()
docnames = frappe.get_all(doc.reference_doctype, {'subscription': doc.name})
self.assertEquals(len(docnames), 1)
self.assertEqual(len(docnames), 1)
doc = frappe.get_doc('Subscription', doc.name)
doc.disabled = 0
@ -70,7 +70,7 @@ class TestSubscription(unittest.TestCase):
make_subscription_entry()
docnames = frappe.get_all(doc.reference_doctype, {'subscription': doc.name})
self.assertEquals(len(docnames), months)
self.assertEqual(len(docnames), months)
quotation_records = frappe.get_test_records('Quotation')

View File

@ -44,7 +44,7 @@ class TestTaxRule(unittest.TestCase):
sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", priority = 1, from_date = "2015-01-01")
tax_rule1.save()
self.assertEquals(get_tax_template("2015-01-01", {"customer_group" : "Commercial", "use_for_shopping_cart":0}),
self.assertEqual(get_tax_template("2015-01-01", {"customer_group" : "Commercial", "use_for_shopping_cart":0}),
"_Test Sales Taxes and Charges Template - _TC")
def test_conflict_with_overlapping_dates(self):
@ -59,7 +59,7 @@ class TestTaxRule(unittest.TestCase):
def test_tax_template(self):
tax_rule = make_tax_rule()
self.assertEquals(tax_rule.purchase_tax_template, None)
self.assertEqual(tax_rule.purchase_tax_template, None)
def test_select_tax_rule_based_on_customer(self):
@ -72,7 +72,7 @@ class TestTaxRule(unittest.TestCase):
make_tax_rule(customer= "_Test Customer 2",
sales_tax_template = "_Test Sales Taxes and Charges Template 2 - _TC", save=1)
self.assertEquals(get_tax_template("2015-01-01", {"customer":"_Test Customer 2"}),
self.assertEqual(get_tax_template("2015-01-01", {"customer":"_Test Customer 2"}),
"_Test Sales Taxes and Charges Template 2 - _TC")
def test_select_tax_rule_based_on_better_match(self):
@ -82,7 +82,7 @@ class TestTaxRule(unittest.TestCase):
make_tax_rule(customer= "_Test Customer", billing_city = "Test City1", billing_state = "Test State",
sales_tax_template = "_Test Sales Taxes and Charges Template 1 - _TC", save=1)
self.assertEquals(get_tax_template("2015-01-01", {"customer":"_Test Customer", "billing_city": "Test City", "billing_state": "Test State"}),
self.assertEqual(get_tax_template("2015-01-01", {"customer":"_Test Customer", "billing_city": "Test City", "billing_state": "Test State"}),
"_Test Sales Taxes and Charges Template - _TC")
def test_select_tax_rule_based_on_state_match(self):
@ -92,7 +92,7 @@ class TestTaxRule(unittest.TestCase):
make_tax_rule(customer= "_Test Customer", shipping_state = "Test State12",
sales_tax_template = "_Test Sales Taxes and Charges Template 1 - _TC", priority=2, save=1)
self.assertEquals(get_tax_template("2015-01-01", {"customer":"_Test Customer", "shipping_state": "Test State"}),
self.assertEqual(get_tax_template("2015-01-01", {"customer":"_Test Customer", "shipping_state": "Test State"}),
"_Test Sales Taxes and Charges Template - _TC")
def test_select_tax_rule_based_on_better_priority(self):
@ -102,7 +102,7 @@ class TestTaxRule(unittest.TestCase):
make_tax_rule(customer= "_Test Customer", billing_city = "Test City",
sales_tax_template = "_Test Sales Taxes and Charges Template 1 - _TC", priority=2, save=1)
self.assertEquals(get_tax_template("2015-01-01", {"customer":"_Test Customer", "billing_city": "Test City"}),
self.assertEqual(get_tax_template("2015-01-01", {"customer":"_Test Customer", "billing_city": "Test City"}),
"_Test Sales Taxes and Charges Template 1 - _TC")
def test_select_tax_rule_based_cross_matching_keys(self):
@ -112,7 +112,7 @@ class TestTaxRule(unittest.TestCase):
make_tax_rule(customer= "_Test Customer 1", billing_city = "Test City 1",
sales_tax_template = "_Test Sales Taxes and Charges Template 1 - _TC", save=1)
self.assertEquals(get_tax_template("2015-01-01", {"customer":"_Test Customer", "billing_city": "Test City 1"}),
self.assertEqual(get_tax_template("2015-01-01", {"customer":"_Test Customer", "billing_city": "Test City 1"}),
None)
def test_select_tax_rule_based_cross_partially_keys(self):
@ -122,7 +122,7 @@ class TestTaxRule(unittest.TestCase):
make_tax_rule(billing_city = "Test City 1",
sales_tax_template = "_Test Sales Taxes and Charges Template 1 - _TC", save=1)
self.assertEquals(get_tax_template("2015-01-01", {"customer":"_Test Customer", "billing_city": "Test City 1"}),
self.assertEqual(get_tax_template("2015-01-01", {"customer":"_Test Customer", "billing_city": "Test City 1"}),
"_Test Sales Taxes and Charges Template 1 - _TC")

View File

@ -11,4 +11,4 @@ test_dependencies = ["Fertilizer"]
class TestCrop(unittest.TestCase):
def test_crop_period(self):
basil = frappe.get_doc('Crop', 'Basil from seed')
self.assertEquals(basil.period, 15)
self.assertEqual(basil.period, 15)

View File

@ -11,11 +11,11 @@ test_dependencies = ["Crop", "Fertilizer", "Land Unit", "Disease"]
class TestCropCycle(unittest.TestCase):
def test_crop_cycle_creation(self):
cycle = frappe.get_doc('Crop Cycle', 'Basil from seed 2017')
self.assertEquals(frappe.db.exists('Crop Cycle', 'Basil from seed 2017'), 'Basil from seed 2017')
self.assertEqual(frappe.db.exists('Crop Cycle', 'Basil from seed 2017'), 'Basil from seed 2017')
# check if the tasks were created
self.assertEquals(check_task_creation(), True)
self.assertEquals(check_project_creation(), True)
self.assertEqual(check_task_creation(), True)
self.assertEqual(check_project_creation(), True)
def check_task_creation():
all_task_dict = {

View File

@ -9,4 +9,4 @@ import unittest
class TestDisease(unittest.TestCase):
def test_treatment_period(self):
disease = frappe.get_doc('Disease', 'Aphids')
self.assertEquals(disease.treatment_period, 3)
self.assertEqual(disease.treatment_period, 3)

View File

@ -8,4 +8,4 @@ import unittest
class TestFertilizer(unittest.TestCase):
def test_fertilizer_creation(self):
self.assertEquals(frappe.db.exists('Fertilizer', 'Urea'), 'Urea')
self.assertEqual(frappe.db.exists('Fertilizer', 'Urea'), 'Urea')

View File

@ -22,5 +22,5 @@ class TestLandUnit(unittest.TestCase):
formatted_land_units.extend(temp['features'])
formatted_land_unit_string = str(formatted_land_units)
test_land = frappe.get_doc('Land Unit', 'Test Land')
self.assertEquals(formatted_land_unit_string, str(json.loads(test_land.get('location'))['features']))
self.assertEquals(area, test_land.get('area'))
self.assertEqual(formatted_land_unit_string, str(json.loads(test_land.get('location'))['features']))
self.assertEqual(area, test_land.get('area'))

View File

@ -10,5 +10,5 @@ class TestSoilTexture(unittest.TestCase):
def test_texture_selection(self):
soil_tex = frappe.get_all('Soil Texture', fields=['name'], filters={'collection_datetime': '2017-11-08'})
doc = frappe.get_doc('Soil Texture', soil_tex[0].name)
self.assertEquals(doc.silt_composition, 50)
self.assertEquals(doc.soil_type, 'Silt Loam')
self.assertEqual(doc.silt_composition, 50)
self.assertEqual(doc.soil_type, 'Silt Loam')

View File

@ -17,7 +17,7 @@ class TestPurchaseOrder(unittest.TestCase):
po.submit()
pr = create_pr_against_po(po.name)
self.assertEquals(len(pr.get("items")), 1)
self.assertEqual(len(pr.get("items")), 1)
def test_ordered_qty(self):
existing_ordered_qty = get_ordered_qty()
@ -32,7 +32,7 @@ class TestPurchaseOrder(unittest.TestCase):
self.assertEqual(get_ordered_qty(), existing_ordered_qty + 6)
po.load_from_db()
self.assertEquals(po.get("items")[0].received_qty, 4)
self.assertEqual(po.get("items")[0].received_qty, 4)
frappe.db.set_value('Item', '_Test Item', 'tolerance', 50)
@ -40,13 +40,13 @@ class TestPurchaseOrder(unittest.TestCase):
self.assertEqual(get_ordered_qty(), existing_ordered_qty)
po.load_from_db()
self.assertEquals(po.get("items")[0].received_qty, 12)
self.assertEqual(po.get("items")[0].received_qty, 12)
pr.cancel()
self.assertEqual(get_ordered_qty(), existing_ordered_qty + 6)
po.load_from_db()
self.assertEquals(po.get("items")[0].received_qty, 4)
self.assertEqual(po.get("items")[0].received_qty, 4)
def test_ordered_qty_against_pi_with_update_stock(self):
existing_ordered_qty = get_ordered_qty()
@ -66,13 +66,13 @@ class TestPurchaseOrder(unittest.TestCase):
self.assertEqual(get_ordered_qty(), existing_ordered_qty)
po.load_from_db()
self.assertEquals(po.get("items")[0].received_qty, 12)
self.assertEqual(po.get("items")[0].received_qty, 12)
pi.cancel()
self.assertEqual(get_ordered_qty(), existing_ordered_qty + 10)
po.load_from_db()
self.assertEquals(po.get("items")[0].received_qty, 0)
self.assertEqual(po.get("items")[0].received_qty, 0)
def test_make_purchase_invoice(self):
po = create_purchase_order(do_not_submit=True)
@ -82,8 +82,8 @@ class TestPurchaseOrder(unittest.TestCase):
po.submit()
pi = make_purchase_invoice(po.name)
self.assertEquals(pi.doctype, "Purchase Invoice")
self.assertEquals(len(pi.get("items", [])), 1)
self.assertEqual(pi.doctype, "Purchase Invoice")
self.assertEqual(len(pi.get("items", [])), 1)
def test_make_purchase_invoice_with_terms(self):
po = create_purchase_order(do_not_save=True)
@ -104,8 +104,8 @@ class TestPurchaseOrder(unittest.TestCase):
pi = make_purchase_invoice(po.name)
pi.save()
self.assertEquals(pi.doctype, "Purchase Invoice")
self.assertEquals(len(pi.get("items", [])), 1)
self.assertEqual(pi.doctype, "Purchase Invoice")
self.assertEqual(len(pi.get("items", [])), 1)
self.assertEqual(pi.payment_schedule[0].payment_amount, 2500.0)
self.assertEqual(pi.payment_schedule[0].due_date, po.transaction_date)
@ -114,7 +114,7 @@ class TestPurchaseOrder(unittest.TestCase):
def test_subcontracting(self):
po = create_purchase_order(item_code="_Test FG Item", is_subcontracted="Yes")
self.assertEquals(len(po.get("supplied_items")), 2)
self.assertEqual(len(po.get("supplied_items")), 2)
def test_warehouse_company_validation(self):
from erpnext.stock.utils import InvalidWarehouseCompany
@ -134,11 +134,11 @@ class TestPurchaseOrder(unittest.TestCase):
po = create_purchase_order(item_code= "_Test Item", qty=1)
self.assertEquals(get_ordered_qty(item_code= "_Test Item", warehouse="_Test Warehouse - _TC"), existing_ordered_qty+1)
self.assertEqual(get_ordered_qty(item_code= "_Test Item", warehouse="_Test Warehouse - _TC"), existing_ordered_qty+1)
po.update_status("Closed")
self.assertEquals(get_ordered_qty(item_code="_Test Item", warehouse="_Test Warehouse - _TC"), existing_ordered_qty)
self.assertEqual(get_ordered_qty(item_code="_Test Item", warehouse="_Test Warehouse - _TC"), existing_ordered_qty)
def test_group_same_items(self):
frappe.db.set_value("Buying Settings", None, "allow_multiple_items", 1)
@ -199,8 +199,8 @@ class TestPurchaseOrder(unittest.TestCase):
bin2 = frappe.db.get_value("Bin",
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname=["reserved_qty_for_sub_contract", "projected_qty"], as_dict=1)
self.assertEquals(bin2.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract + 10)
self.assertEquals(bin2.projected_qty, bin1.projected_qty - 10)
self.assertEqual(bin2.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract + 10)
self.assertEqual(bin2.projected_qty, bin1.projected_qty - 10)
# Create stock transfer
rm_item = [{"item_code":"_Test FG Item","rm_item_code":"_Test Item","item_name":"_Test Item",
@ -215,7 +215,7 @@ class TestPurchaseOrder(unittest.TestCase):
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname="reserved_qty_for_sub_contract", as_dict=1)
self.assertEquals(bin3.reserved_qty_for_sub_contract, bin2.reserved_qty_for_sub_contract - 6)
self.assertEqual(bin3.reserved_qty_for_sub_contract, bin2.reserved_qty_for_sub_contract - 6)
# close PO
po.update_status("Closed")
@ -223,7 +223,7 @@ class TestPurchaseOrder(unittest.TestCase):
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname="reserved_qty_for_sub_contract", as_dict=1)
self.assertEquals(bin4.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract)
self.assertEqual(bin4.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract)
# Re-open PO
po.update_status("Submitted")
@ -231,7 +231,7 @@ class TestPurchaseOrder(unittest.TestCase):
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname="reserved_qty_for_sub_contract", as_dict=1)
self.assertEquals(bin5.reserved_qty_for_sub_contract, bin2.reserved_qty_for_sub_contract - 6)
self.assertEqual(bin5.reserved_qty_for_sub_contract, bin2.reserved_qty_for_sub_contract - 6)
# make Purchase Receipt against PO
pr = make_purchase_receipt(po.name)
@ -243,7 +243,7 @@ class TestPurchaseOrder(unittest.TestCase):
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname="reserved_qty_for_sub_contract", as_dict=1)
self.assertEquals(bin6.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract)
self.assertEqual(bin6.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract)
# Cancel PR
pr.cancel()
@ -251,7 +251,7 @@ class TestPurchaseOrder(unittest.TestCase):
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname="reserved_qty_for_sub_contract", as_dict=1)
self.assertEquals(bin7.reserved_qty_for_sub_contract, bin2.reserved_qty_for_sub_contract - 6)
self.assertEqual(bin7.reserved_qty_for_sub_contract, bin2.reserved_qty_for_sub_contract - 6)
# Make Purchase Invoice
pi = make_purchase_invoice(po.name)
@ -263,7 +263,7 @@ class TestPurchaseOrder(unittest.TestCase):
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname="reserved_qty_for_sub_contract", as_dict=1)
self.assertEquals(bin8.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract)
self.assertEqual(bin8.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract)
# Cancel PR
pi.cancel()
@ -271,14 +271,14 @@ class TestPurchaseOrder(unittest.TestCase):
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname="reserved_qty_for_sub_contract", as_dict=1)
self.assertEquals(bin9.reserved_qty_for_sub_contract, bin2.reserved_qty_for_sub_contract - 6)
self.assertEqual(bin9.reserved_qty_for_sub_contract, bin2.reserved_qty_for_sub_contract - 6)
# Cancel Stock Entry
se.cancel()
bin10 = frappe.db.get_value("Bin",
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname="reserved_qty_for_sub_contract", as_dict=1)
self.assertEquals(bin10.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract + 10)
self.assertEqual(bin10.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract + 10)
# Cancel PO
po.reload()
@ -287,7 +287,7 @@ class TestPurchaseOrder(unittest.TestCase):
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname="reserved_qty_for_sub_contract", as_dict=1)
self.assertEquals(bin11.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract)
self.assertEqual(bin11.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract)
def get_same_items():
return [

View File

@ -14,8 +14,8 @@ class TestRequestforQuotation(unittest.TestCase):
from erpnext.buying.doctype.request_for_quotation.request_for_quotation import make_supplier_quotation
rfq = make_request_for_quotation()
self.assertEquals(rfq.get('suppliers')[0].quote_status, 'Pending')
self.assertEquals(rfq.get('suppliers')[1].quote_status, 'Pending')
self.assertEqual(rfq.get('suppliers')[0].quote_status, 'Pending')
self.assertEqual(rfq.get('suppliers')[1].quote_status, 'Pending')
# Submit the first supplier quotation
sq = make_supplier_quotation(rfq.name, rfq.get('suppliers')[0].supplier)
@ -27,8 +27,8 @@ class TestRequestforQuotation(unittest.TestCase):
rfq.update_rfq_supplier_status() #rfq.get('suppliers')[1].supplier)
self.assertEquals(rfq.get('suppliers')[0].quote_status, 'Received')
self.assertEquals(rfq.get('suppliers')[1].quote_status, 'No Quote')
self.assertEqual(rfq.get('suppliers')[0].quote_status, 'Received')
self.assertEqual(rfq.get('suppliers')[1].quote_status, 'No Quote')
def test_make_supplier_quotation(self):
from erpnext.buying.doctype.request_for_quotation.request_for_quotation import make_supplier_quotation
@ -40,15 +40,15 @@ class TestRequestforQuotation(unittest.TestCase):
sq1 = make_supplier_quotation(rfq.name, rfq.get('suppliers')[1].supplier)
sq1.submit()
self.assertEquals(sq.supplier, rfq.get('suppliers')[0].supplier)
self.assertEquals(sq.get('items')[0].request_for_quotation, rfq.name)
self.assertEquals(sq.get('items')[0].item_code, "_Test Item")
self.assertEquals(sq.get('items')[0].qty, 5)
self.assertEqual(sq.supplier, rfq.get('suppliers')[0].supplier)
self.assertEqual(sq.get('items')[0].request_for_quotation, rfq.name)
self.assertEqual(sq.get('items')[0].item_code, "_Test Item")
self.assertEqual(sq.get('items')[0].qty, 5)
self.assertEquals(sq1.supplier, rfq.get('suppliers')[1].supplier)
self.assertEquals(sq1.get('items')[0].request_for_quotation, rfq.name)
self.assertEquals(sq1.get('items')[0].item_code, "_Test Item")
self.assertEquals(sq1.get('items')[0].qty, 5)
self.assertEqual(sq1.supplier, rfq.get('suppliers')[1].supplier)
self.assertEqual(sq1.get('items')[0].request_for_quotation, rfq.name)
self.assertEqual(sq1.get('items')[0].item_code, "_Test Item")
self.assertEqual(sq1.get('items')[0].qty, 5)
def test_make_supplier_quotation_with_special_characters(self):
from erpnext.buying.doctype.request_for_quotation.request_for_quotation import make_supplier_quotation
@ -84,11 +84,11 @@ class TestRequestforQuotation(unittest.TestCase):
supplier_quotation_doc = frappe.get_doc('Supplier Quotation', supplier_quotation_name)
self.assertEquals(supplier_quotation_doc.supplier, rfq.get('suppliers')[0].supplier)
self.assertEquals(supplier_quotation_doc.get('items')[0].request_for_quotation, rfq.name)
self.assertEquals(supplier_quotation_doc.get('items')[0].item_code, "_Test Item")
self.assertEquals(supplier_quotation_doc.get('items')[0].qty, 5)
self.assertEquals(supplier_quotation_doc.get('items')[0].amount, 500)
self.assertEqual(supplier_quotation_doc.supplier, rfq.get('suppliers')[0].supplier)
self.assertEqual(supplier_quotation_doc.get('items')[0].request_for_quotation, rfq.name)
self.assertEqual(supplier_quotation_doc.get('items')[0].item_code, "_Test Item")
self.assertEqual(supplier_quotation_doc.get('items')[0].qty, 5)
self.assertEqual(supplier_quotation_doc.get('items')[0].amount, 500)
def make_request_for_quotation(supplier_data=None):

View File

@ -20,8 +20,8 @@ class TestPurchaseOrder(unittest.TestCase):
sq.submit()
po = make_purchase_order(sq.name)
self.assertEquals(po.doctype, "Purchase Order")
self.assertEquals(len(po.get("items")), len(sq.get("items")))
self.assertEqual(po.doctype, "Purchase Order")
self.assertEqual(len(po.get("items")), len(sq.get("items")))
po.naming_series = "_T-Purchase Order-"

View File

@ -13,9 +13,9 @@ class TestSupplierScorecardVariable(unittest.TestCase):
def test_variable_exist(self):
for d in test_existing_variables:
my_doc = frappe.get_doc("Supplier Scorecard Variable", d.get("name"))
self.assertEquals(my_doc.param_name, d.get('param_name'))
self.assertEquals(my_doc.variable_label, d.get('variable_label'))
self.assertEquals(my_doc.path, d.get('path'))
self.assertEqual(my_doc.param_name, d.get('param_name'))
self.assertEqual(my_doc.variable_label, d.get('variable_label'))
self.assertEqual(my_doc.path, d.get('path'))
def test_path_exists(self):
for d in test_good_variables:

View File

@ -15,8 +15,8 @@ class TestLead(unittest.TestCase):
frappe.delete_doc_if_exists("Customer", "_Test Lead")
customer = make_customer("_T-Lead-00001")
self.assertEquals(customer.doctype, "Customer")
self.assertEquals(customer.lead_name, "_T-Lead-00001")
self.assertEqual(customer.doctype, "Customer")
self.assertEqual(customer.lead_name, "_T-Lead-00001")
customer.company = "_Test Company"
customer.customer_group = "_Test Customer Group"
@ -26,8 +26,8 @@ class TestLead(unittest.TestCase):
from erpnext.crm.doctype.lead.lead import make_customer
customer = make_customer("_T-Lead-00002")
self.assertEquals(customer.doctype, "Customer")
self.assertEquals(customer.lead_name, "_T-Lead-00002")
self.assertEqual(customer.doctype, "Customer")
self.assertEqual(customer.lead_name, "_T-Lead-00002")
customer.company = "_Test Company"
customer.customer_group = "_Test Customer Group"

View File

@ -24,7 +24,7 @@ class TestOpportunity(unittest.TestCase):
quotation.submit()
doc = frappe.get_doc('Opportunity', doc.name)
self.assertEquals(doc.status, "Quotation")
self.assertEqual(doc.status, "Quotation")
def test_make_new_lead_if_required(self):
args = {
@ -38,8 +38,8 @@ class TestOpportunity(unittest.TestCase):
opp_doc = frappe.get_doc(args).insert(ignore_permissions=True)
self.assertTrue(opp_doc.lead)
self.assertEquals(opp_doc.enquiry_from, "Lead")
self.assertEquals(frappe.db.get_value("Lead", opp_doc.lead, "email_id"),
self.assertEqual(opp_doc.enquiry_from, "Lead")
self.assertEqual(frappe.db.get_value("Lead", opp_doc.lead, "email_id"),
'new.opportunity@example.com')
# create new customer and create new contact against 'new.opportunity@example.com'
@ -56,8 +56,8 @@ class TestOpportunity(unittest.TestCase):
opp_doc = frappe.get_doc(args).insert(ignore_permissions=True)
self.assertTrue(opp_doc.customer)
self.assertEquals(opp_doc.enquiry_from, "Customer")
self.assertEquals(opp_doc.customer, customer.name)
self.assertEqual(opp_doc.enquiry_from, "Customer")
self.assertEqual(opp_doc.customer, customer.name)
def make_opportunity(**args):
args = frappe._dict(args)

View File

@ -12,8 +12,8 @@ from erpnext.education.api import get_grade
class TestAssessmentResult(unittest.TestCase):
def test_grade(self):
grade = get_grade("_Test Grading Scale", 80)
self.assertEquals("A", grade)
self.assertEqual("A", grade)
grade = get_grade("_Test Grading Scale", 70)
self.assertEquals("B", grade)
self.assertEqual("B", grade)

View File

@ -42,12 +42,12 @@ class TestFees(unittest.TestCase):
from `tabGL Entry` where voucher_type=%s and voucher_no=%s""", ("Fees", fee.name), as_dict=True)
if gl_entries[0].account == "_Test Receivable - _TC":
self.assertEquals(gl_entries[0].debit, 50000)
self.assertEquals(gl_entries[0].credit, 0)
self.assertEquals(gl_entries[1].debit, 0)
self.assertEquals(gl_entries[1].credit, 50000)
self.assertEqual(gl_entries[0].debit, 50000)
self.assertEqual(gl_entries[0].credit, 0)
self.assertEqual(gl_entries[1].debit, 0)
self.assertEqual(gl_entries[1].credit, 50000)
else:
self.assertEquals(gl_entries[0].credit, 50000)
self.assertEquals(gl_entries[0].debit, 0)
self.assertEquals(gl_entries[1].credit, 0)
self.assertEquals(gl_entries[1].debit, 50000)
self.assertEqual(gl_entries[0].credit, 50000)
self.assertEqual(gl_entries[0].debit, 0)
self.assertEqual(gl_entries[1].credit, 0)
self.assertEqual(gl_entries[1].debit, 50000)

View File

@ -23,5 +23,5 @@ class TestStudentGroup(unittest.TestCase):
doc.extend("students", [{"student":d} for d in student_list])
doc.save()
self.assertEquals(max([d.group_roll_number for d in doc.students]), 3)
self.assertEqual(max([d.group_roll_number for d in doc.students]), 3)

View File

@ -17,26 +17,26 @@ class TestEmployeeLoan(unittest.TestCase):
def test_employee_loan(self):
employee_loan = frappe.get_doc("Employee Loan", {"employee":self.employee})
self.assertEquals(employee_loan.monthly_repayment_amount, 15052)
self.assertEquals(employee_loan.total_interest_payable, 21034)
self.assertEquals(employee_loan.total_payment, 301034)
self.assertEqual(employee_loan.monthly_repayment_amount, 15052)
self.assertEqual(employee_loan.total_interest_payable, 21034)
self.assertEqual(employee_loan.total_payment, 301034)
schedule = employee_loan.repayment_schedule
self.assertEquals(len(schedule), 20)
self.assertEqual(len(schedule), 20)
for idx, principal_amount, interest_amount, balance_loan_amount in [[3, 13369, 1683, 227079], [19, 14941, 105, 0], [17, 14740, 312, 29785]]:
self.assertEquals(schedule[idx].principal_amount, principal_amount)
self.assertEquals(schedule[idx].interest_amount, interest_amount)
self.assertEquals(schedule[idx].balance_loan_amount, balance_loan_amount)
self.assertEqual(schedule[idx].principal_amount, principal_amount)
self.assertEqual(schedule[idx].interest_amount, interest_amount)
self.assertEqual(schedule[idx].balance_loan_amount, balance_loan_amount)
employee_loan.repayment_method = "Repay Fixed Amount per Period"
employee_loan.monthly_repayment_amount = 14000
employee_loan.save()
self.assertEquals(len(employee_loan.repayment_schedule), 22)
self.assertEquals(employee_loan.total_interest_payable, 22712)
self.assertEquals(employee_loan.total_payment, 302712)
self.assertEqual(len(employee_loan.repayment_schedule), 22)
self.assertEqual(employee_loan.total_interest_payable, 22712)
self.assertEqual(employee_loan.total_payment, 302712)
def create_loan_type(loan_name, maximum_loan_amount, rate_of_interest):
if not frappe.db.exists("Loan Type", loan_name):

View File

@ -38,14 +38,14 @@ class TestEmployeeLoanApplication(unittest.TestCase):
def test_loan_totals(self):
loan_application = frappe.get_doc("Employee Loan Application", {"employee":self.employee})
self.assertEquals(loan_application.repayment_amount, 11445)
self.assertEquals(loan_application.total_payable_interest, 24657)
self.assertEquals(loan_application.total_payable_amount, 274657)
self.assertEqual(loan_application.repayment_amount, 11445)
self.assertEqual(loan_application.total_payable_interest, 24657)
self.assertEqual(loan_application.total_payable_amount, 274657)
loan_application.repayment_method = "Repay Fixed Amount per Period"
loan_application.repayment_amount = 15000
loan_application.save()
self.assertEquals(loan_application.repayment_periods, 18)
self.assertEquals(loan_application.total_payable_interest, 18506)
self.assertEquals(loan_application.total_payable_amount, 268506)
self.assertEqual(loan_application.repayment_periods, 18)
self.assertEqual(loan_application.total_payable_interest, 18506)
self.assertEqual(loan_application.total_payable_amount, 268506)

View File

@ -77,9 +77,9 @@ class TestExpenseClaim(unittest.TestCase):
])
for gle in gl_entries:
self.assertEquals(expected_values[gle.account][0], gle.account)
self.assertEquals(expected_values[gle.account][1], gle.debit)
self.assertEquals(expected_values[gle.account][2], gle.credit)
self.assertEqual(expected_values[gle.account][0], gle.account)
self.assertEqual(expected_values[gle.account][1], gle.debit)
self.assertEqual(expected_values[gle.account][2], gle.credit)
def get_payable_account(company):
return frappe.db.get_value('Company', company, 'default_payable_account')

View File

@ -23,7 +23,7 @@ class TestLeaveBlockList(unittest.TestCase):
frappe.set_user("test1@example.com")
frappe.db.set_value("Department", "_Test Department 1", "leave_block_list",
"_Test Leave Block List")
self.assertEquals([], [d.block_date for d in get_applicable_block_dates("2013-01-01", "2013-01-03")])
self.assertEqual([], [d.block_date for d in get_applicable_block_dates("2013-01-01", "2013-01-03")])
def test_get_applicable_block_dates_all_lists(self):
frappe.set_user("test1@example.com")

View File

@ -37,14 +37,14 @@ class TestSalarySlip(unittest.TestCase):
ss = frappe.get_doc("Salary Slip",
self.make_employee_salary_slip("test_employee@salary.com", "Monthly"))
self.assertEquals(ss.total_working_days, no_of_days[0])
self.assertEquals(ss.payment_days, no_of_days[0])
self.assertEquals(ss.earnings[0].amount, 25000)
self.assertEquals(ss.earnings[1].amount, 3000)
self.assertEquals(ss.deductions[0].amount, 5000)
self.assertEquals(ss.deductions[1].amount, 5000)
self.assertEquals(ss.gross_pay, 40500)
self.assertEquals(ss.net_pay, 29918)
self.assertEqual(ss.total_working_days, no_of_days[0])
self.assertEqual(ss.payment_days, no_of_days[0])
self.assertEqual(ss.earnings[0].amount, 25000)
self.assertEqual(ss.earnings[1].amount, 3000)
self.assertEqual(ss.deductions[0].amount, 5000)
self.assertEqual(ss.deductions[1].amount, 5000)
self.assertEqual(ss.gross_pay, 40500)
self.assertEqual(ss.net_pay, 29918)
def test_salary_slip_with_holidays_excluded(self):
no_of_days = self.get_no_of_days()
@ -55,15 +55,15 @@ class TestSalarySlip(unittest.TestCase):
ss = frappe.get_doc("Salary Slip",
self.make_employee_salary_slip("test_employee@salary.com", "Monthly"))
self.assertEquals(ss.total_working_days, no_of_days[0] - no_of_days[1])
self.assertEquals(ss.payment_days, no_of_days[0] - no_of_days[1])
self.assertEquals(ss.earnings[0].amount, 25000)
self.assertEquals(ss.earnings[0].default_amount, 25000)
self.assertEquals(ss.earnings[1].amount, 3000)
self.assertEquals(ss.deductions[0].amount, 5000)
self.assertEquals(ss.deductions[1].amount, 5000)
self.assertEquals(ss.gross_pay, 40500)
self.assertEquals(ss.net_pay, 29918)
self.assertEqual(ss.total_working_days, no_of_days[0] - no_of_days[1])
self.assertEqual(ss.payment_days, no_of_days[0] - no_of_days[1])
self.assertEqual(ss.earnings[0].amount, 25000)
self.assertEqual(ss.earnings[0].default_amount, 25000)
self.assertEqual(ss.earnings[1].amount, 3000)
self.assertEqual(ss.deductions[0].amount, 5000)
self.assertEqual(ss.deductions[1].amount, 5000)
self.assertEqual(ss.gross_pay, 40500)
self.assertEqual(ss.net_pay, 29918)
def test_payment_days(self):
no_of_days = self.get_no_of_days()
@ -95,8 +95,8 @@ class TestSalarySlip(unittest.TestCase):
ss = frappe.get_doc("Salary Slip",
self.make_employee_salary_slip("test_employee@salary.com", "Monthly"))
self.assertEquals(ss.total_working_days, no_of_days[0])
self.assertEquals(ss.payment_days, (no_of_days[0] - getdate(date_of_joining).day + 1))
self.assertEqual(ss.total_working_days, no_of_days[0])
self.assertEqual(ss.payment_days, (no_of_days[0] - getdate(date_of_joining).day + 1))
# set relieving date in the same month
frappe.db.set_value("Employee", frappe.get_value("Employee", {"employee_name":"test_employee@salary.com"}, "name"), "date_of_joining", (add_days(nowdate(),-60)))
@ -104,8 +104,8 @@ class TestSalarySlip(unittest.TestCase):
frappe.db.set_value("Employee", frappe.get_value("Employee", {"employee_name":"test_employee@salary.com"}, "name"), "status", "Left")
ss.save()
self.assertEquals(ss.total_working_days, no_of_days[0])
self.assertEquals(ss.payment_days, getdate(relieving_date).day)
self.assertEqual(ss.total_working_days, no_of_days[0])
self.assertEqual(ss.payment_days, getdate(relieving_date).day)
frappe.db.set_value("Employee", frappe.get_value("Employee", {"employee_name":"test_employee@salary.com"}, "name"), "relieving_date", None)
frappe.db.set_value("Employee", frappe.get_value("Employee", {"employee_name":"test_employee@salary.com"}, "name"), "status", "Active")
@ -143,8 +143,8 @@ class TestSalarySlip(unittest.TestCase):
ss = frappe.get_doc("Salary Slip",
self.make_employee_salary_slip("test_employee@salary.com", "Monthly"))
ss.submit()
self.assertEquals(ss.total_loan_repayment, 582)
self.assertEquals(ss.net_pay, (flt(ss.gross_pay) - (flt(ss.total_deduction) + flt(ss.total_loan_repayment))))
self.assertEqual(ss.total_loan_repayment, 582)
self.assertEqual(ss.net_pay, (flt(ss.gross_pay) - (flt(ss.total_deduction) + flt(ss.total_loan_repayment))))
def test_payroll_frequency(self):
fiscal_year = get_fiscal_year(nowdate(), company="_Test Company")[0]

View File

@ -36,12 +36,12 @@ class TestSalaryStructure(unittest.TestCase):
sal_slip = frappe.get_value("Salary Slip", {"employee_name":"test_employee@salary.com"})
if not sal_slip:
sal_slip = make_salary_slip_from_salary_structure(employee=frappe.get_value("Employee", {"employee_name":"test_employee@salary.com"}))
self.assertEquals(sal_slip.get("salary_structure"), 'Salary Structure Sample')
self.assertEquals(sal_slip.get("earnings")[0].amount, 5000)
self.assertEquals(sal_slip.get("deductions")[0].amount, 5000)
self.assertEquals(sal_slip.get("deductions")[1].amount, 2500)
self.assertEquals(sal_slip.get("total_deduction"), 7500)
self.assertEquals(sal_slip.get("net_pay"), 7500)
self.assertEqual(sal_slip.get("salary_structure"), 'Salary Structure Sample')
self.assertEqual(sal_slip.get("earnings")[0].amount, 5000)
self.assertEqual(sal_slip.get("deductions")[0].amount, 5000)
self.assertEqual(sal_slip.get("deductions")[1].amount, 2500)
self.assertEqual(sal_slip.get("total_deduction"), 7500)
self.assertEqual(sal_slip.get("net_pay"), 7500)
def test_whitespaces_in_formula_conditions_fields(self):
make_salary_structure("Salary Structure Sample")

View File

@ -18,7 +18,7 @@ class TestBOM(unittest.TestCase):
company="_Test Company", qty=1, fetch_exploded=0)
self.assertTrue(test_records[2]["items"][0]["item_code"] in items_dict)
self.assertTrue(test_records[2]["items"][1]["item_code"] in items_dict)
self.assertEquals(len(items_dict.values()), 2)
self.assertEqual(len(items_dict.values()), 2)
def test_get_items_exploded(self):
from erpnext.manufacturing.doctype.bom.bom import get_bom_items_as_dict
@ -28,11 +28,11 @@ class TestBOM(unittest.TestCase):
self.assertFalse(test_records[2]["items"][1]["item_code"] in items_dict)
self.assertTrue(test_records[0]["items"][0]["item_code"] in items_dict)
self.assertTrue(test_records[0]["items"][1]["item_code"] in items_dict)
self.assertEquals(len(items_dict.values()), 3)
self.assertEqual(len(items_dict.values()), 3)
def test_get_items_list(self):
from erpnext.manufacturing.doctype.bom.bom import get_bom_items
self.assertEquals(len(get_bom_items(bom=get_default_bom(), company="_Test Company")), 3)
self.assertEqual(len(get_bom_items(bom=get_default_bom(), company="_Test Company")), 3)
def test_default_bom(self):
def _get_default_bom_in_item():

View File

@ -504,4 +504,4 @@ execute:frappe.delete_doc('DocType', 'Production Planning Tool', ignore_missing=
erpnext.patches.v10_0.migrate_daily_work_summary_settings_to_daily_work_summary_group
erpnext.patches.v10_0.add_default_cash_flow_mappers
erpnext.patches.v11_0.make_quality_inspection_template
erpnext.patches.v10_0.update_territory_and_customer_group
# erpnext.patches.v10_0.update_territory_and_customer_group

View File

@ -78,16 +78,16 @@ class TestTask(unittest.TestCase):
assign()
todo = get_owner_and_status()
self.assertEquals(todo.owner, "test@example.com")
self.assertEquals(todo.status, "Open")
self.assertEqual(todo.owner, "test@example.com")
self.assertEqual(todo.status, "Open")
# assignment should be
task.load_from_db()
task.status = "Closed"
task.save()
todo = get_owner_and_status()
self.assertEquals(todo.owner, "test@example.com")
self.assertEquals(todo.status, "Closed")
self.assertEqual(todo.owner, "test@example.com")
self.assertEqual(todo.status, "Closed")
def test_overdue(self):
task = create_task("Testing Overdue", add_days(nowdate(), -10), add_days(nowdate(), -5))
@ -95,7 +95,7 @@ class TestTask(unittest.TestCase):
from erpnext.projects.doctype.task.task import set_tasks_as_overdue
set_tasks_as_overdue()
self.assertEquals(frappe.db.get_value("Task", task.name, "status"), "Overdue")
self.assertEqual(frappe.db.get_value("Task", task.name, "status"), "Overdue")
def create_task(subject, start=None, end=None, depends_on=None, project=None):
if not frappe.db.exists("Task", subject):

View File

@ -17,21 +17,21 @@ class TestTimesheet(unittest.TestCase):
make_salary_structure("_T-Employee-0001")
timesheet = make_timesheet("_T-Employee-0001", simulate=True, billable=1)
self.assertEquals(timesheet.total_hours, 2)
self.assertEquals(timesheet.total_billable_hours, 2)
self.assertEquals(timesheet.time_logs[0].billing_rate, 50)
self.assertEquals(timesheet.time_logs[0].billing_amount, 100)
self.assertEquals(timesheet.total_billable_amount, 100)
self.assertEqual(timesheet.total_hours, 2)
self.assertEqual(timesheet.total_billable_hours, 2)
self.assertEqual(timesheet.time_logs[0].billing_rate, 50)
self.assertEqual(timesheet.time_logs[0].billing_amount, 100)
self.assertEqual(timesheet.total_billable_amount, 100)
def test_timesheet_billing_amount_not_billable(self):
make_salary_structure("_T-Employee-0001")
timesheet = make_timesheet("_T-Employee-0001", simulate=True, billable=0)
self.assertEquals(timesheet.total_hours, 2)
self.assertEquals(timesheet.total_billable_hours, 0)
self.assertEquals(timesheet.time_logs[0].billing_rate, 0)
self.assertEquals(timesheet.time_logs[0].billing_amount, 0)
self.assertEquals(timesheet.total_billable_amount, 0)
self.assertEqual(timesheet.total_hours, 2)
self.assertEqual(timesheet.total_billable_hours, 0)
self.assertEqual(timesheet.time_logs[0].billing_rate, 0)
self.assertEqual(timesheet.time_logs[0].billing_amount, 0)
self.assertEqual(timesheet.total_billable_amount, 0)
def test_salary_slip_from_timesheet(self):
salary_structure = make_salary_structure("_T-Employee-0001")
@ -39,18 +39,18 @@ class TestTimesheet(unittest.TestCase):
salary_slip = make_salary_slip(timesheet.name)
salary_slip.submit()
self.assertEquals(salary_slip.total_working_hours, 2)
self.assertEquals(salary_slip.hour_rate, 50)
self.assertEquals(salary_slip.net_pay, 150)
self.assertEquals(salary_slip.timesheets[0].time_sheet, timesheet.name)
self.assertEquals(salary_slip.timesheets[0].working_hours, 2)
self.assertEqual(salary_slip.total_working_hours, 2)
self.assertEqual(salary_slip.hour_rate, 50)
self.assertEqual(salary_slip.net_pay, 150)
self.assertEqual(salary_slip.timesheets[0].time_sheet, timesheet.name)
self.assertEqual(salary_slip.timesheets[0].working_hours, 2)
timesheet = frappe.get_doc('Timesheet', timesheet.name)
self.assertEquals(timesheet.status, 'Payslip')
self.assertEqual(timesheet.status, 'Payslip')
salary_slip.cancel()
timesheet = frappe.get_doc('Timesheet', timesheet.name)
self.assertEquals(timesheet.status, 'Submitted')
self.assertEqual(timesheet.status, 'Submitted')
def test_sales_invoice_from_timesheet(self):
timesheet = make_timesheet("_T-Employee-0001", simulate=True, billable=1)
@ -58,14 +58,14 @@ class TestTimesheet(unittest.TestCase):
sales_invoice.due_date = nowdate()
sales_invoice.submit()
timesheet = frappe.get_doc('Timesheet', timesheet.name)
self.assertEquals(sales_invoice.total_billing_amount, 100)
self.assertEquals(timesheet.status, 'Billed')
self.assertEquals(sales_invoice.customer, '_Test Customer')
self.assertEqual(sales_invoice.total_billing_amount, 100)
self.assertEqual(timesheet.status, 'Billed')
self.assertEqual(sales_invoice.customer, '_Test Customer')
item = sales_invoice.items[0]
self.assertEquals(item.item_code, '_Test Item')
self.assertEquals(item.qty, 2.00)
self.assertEquals(item.rate, 50.00)
self.assertEqual(item.item_code, '_Test Item')
self.assertEqual(item.qty, 2.00)
self.assertEqual(item.rate, 50.00)
def test_timesheet_billing_based_on_project(self):
timesheet = make_timesheet("_T-Employee-0001", simulate=True, billable=1, project = '_Test Project', company='_Test Company')
@ -74,8 +74,8 @@ class TestTimesheet(unittest.TestCase):
sales_invoice.submit()
ts = frappe.get_doc('Timesheet', timesheet.name)
self.assertEquals(ts.per_billed, 100)
self.assertEquals(ts.time_logs[0].sales_invoice, sales_invoice.name)
self.assertEqual(ts.per_billed, 100)
self.assertEqual(ts.time_logs[0].sales_invoice, sales_invoice.name)
def test_timesheet_time_overlap(self):
settings = frappe.get_single('Projects Settings')

View File

@ -38,15 +38,15 @@ class TestRestaurantMenu(unittest.TestCase):
menu2.save()
self.assertTrue(frappe.db.get_value('Price List', 'Test Restaurant 1 Menu 1'))
self.assertEquals(frappe.db.get_value('Item Price',
self.assertEqual(frappe.db.get_value('Item Price',
dict(price_list = 'Test Restaurant 1 Menu 1', item_code='Food Item 1'), 'price_list_rate'), 400)
self.assertEquals(frappe.db.get_value('Item Price',
self.assertEqual(frappe.db.get_value('Item Price',
dict(price_list = 'Test Restaurant 1 Menu 2', item_code='Food Item 1'), 'price_list_rate'), 450)
menu1.items[0].rate = 401
menu1.save()
self.assertEquals(frappe.db.get_value('Item Price',
self.assertEqual(frappe.db.get_value('Item Price',
dict(price_list = 'Test Restaurant 1 Menu 1', item_code='Food Item 1'), 'price_list_rate'), 401)
menu1.items[0].rate = 400

View File

@ -54,7 +54,7 @@ class TestCustomer(unittest.TestCase):
details = get_party_details("_Test Customer")
for key, value in iteritems(to_check):
self.assertEquals(value, details.get(key))
self.assertEqual(value, details.get(key))
def test_rename(self):
# delete communication linked to these 2 customers
@ -74,7 +74,7 @@ class TestCustomer(unittest.TestCase):
self.assertFalse(frappe.db.exists("Customer", "_Test Customer 1"))
# test that comment gets linked to renamed doc
self.assertEquals(frappe.db.get_value("Communication", {
self.assertEqual(frappe.db.get_value("Communication", {
"communication_type": "Comment",
"reference_doctype": "Customer",
"reference_name": "_Test Customer 1 Renamed"
@ -125,9 +125,9 @@ class TestCustomer(unittest.TestCase):
duplicate_customer = frappe.get_doc(
get_customer_dict('_Test Customer 1')).insert(ignore_permissions=True)
self.assertEquals("_Test Customer 1", test_customer_1.name)
self.assertEquals("_Test Customer 1 - 1", duplicate_customer.name)
self.assertEquals(test_customer_1.customer_name, duplicate_customer.customer_name)
self.assertEqual("_Test Customer 1", test_customer_1.name)
self.assertEqual("_Test Customer 1 - 1", duplicate_customer.name)
self.assertEqual(test_customer_1.customer_name, duplicate_customer.customer_name)
def get_customer_outstanding_amount(self):
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order

View File

@ -44,11 +44,11 @@ class TestQuotation(unittest.TestCase):
sales_order = make_sales_order(quotation.name)
self.assertEquals(sales_order.doctype, "Sales Order")
self.assertEquals(len(sales_order.get("items")), 1)
self.assertEquals(sales_order.get("items")[0].doctype, "Sales Order Item")
self.assertEquals(sales_order.get("items")[0].prevdoc_docname, quotation.name)
self.assertEquals(sales_order.customer, "_Test Customer")
self.assertEqual(sales_order.doctype, "Sales Order")
self.assertEqual(len(sales_order.get("items")), 1)
self.assertEqual(sales_order.get("items")[0].doctype, "Sales Order Item")
self.assertEqual(sales_order.get("items")[0].prevdoc_docname, quotation.name)
self.assertEqual(sales_order.customer, "_Test Customer")
sales_order.delivery_date = "2014-01-01"
sales_order.naming_series = "_T-Quotation-"
@ -77,11 +77,11 @@ class TestQuotation(unittest.TestCase):
sales_order = make_sales_order(quotation.name)
self.assertEquals(sales_order.doctype, "Sales Order")
self.assertEquals(len(sales_order.get("items")), 1)
self.assertEquals(sales_order.get("items")[0].doctype, "Sales Order Item")
self.assertEquals(sales_order.get("items")[0].prevdoc_docname, quotation.name)
self.assertEquals(sales_order.customer, "_Test Customer")
self.assertEqual(sales_order.doctype, "Sales Order")
self.assertEqual(len(sales_order.get("items")), 1)
self.assertEqual(sales_order.get("items")[0].doctype, "Sales Order Item")
self.assertEqual(sales_order.get("items")[0].prevdoc_docname, quotation.name)
self.assertEqual(sales_order.customer, "_Test Customer")
sales_order.delivery_date = "2014-01-01"
sales_order.naming_series = "_T-Quotation-"
@ -123,7 +123,7 @@ class TestQuotation(unittest.TestCase):
quotation.valid_till = add_months(quotation.transaction_date, 1)
quotation.insert()
self.assertEquals(quotation.get("items")[0].rate, rate_with_margin)
self.assertEqual(quotation.get("items")[0].rate, rate_with_margin)
self.assertRaises(frappe.ValidationError, make_sales_order, quotation.name)
quotation.submit()
@ -134,16 +134,16 @@ class TestQuotation(unittest.TestCase):
sales_order.insert()
self.assertEquals(quotation.get("items")[0].rate, rate_with_margin)
self.assertEqual(quotation.get("items")[0].rate, rate_with_margin)
sales_order.submit()
dn = make_delivery_note(sales_order.name)
self.assertEquals(quotation.get("items")[0].rate, rate_with_margin)
self.assertEqual(quotation.get("items")[0].rate, rate_with_margin)
dn.save()
si = make_sales_invoice(sales_order.name)
self.assertEquals(quotation.get("items")[0].rate, rate_with_margin)
self.assertEqual(quotation.get("items")[0].rate, rate_with_margin)
si.save()
def test_create_two_quotations(self):

View File

@ -29,8 +29,8 @@ class TestSalesOrder(unittest.TestCase):
so.submit()
mr = make_material_request(so.name)
self.assertEquals(mr.material_request_type, "Purchase")
self.assertEquals(len(mr.get("items")), len(so.get("items")))
self.assertEqual(mr.material_request_type, "Purchase")
self.assertEqual(len(mr.get("items")), len(so.get("items")))
def test_make_delivery_note(self):
so = make_sales_order(do_not_submit=True)
@ -40,8 +40,8 @@ class TestSalesOrder(unittest.TestCase):
so.submit()
dn = make_delivery_note(so.name)
self.assertEquals(dn.doctype, "Delivery Note")
self.assertEquals(len(dn.get("items")), len(so.get("items")))
self.assertEqual(dn.doctype, "Delivery Note")
self.assertEqual(len(dn.get("items")), len(so.get("items")))
def test_make_sales_invoice(self):
so = make_sales_order(do_not_submit=True)
@ -51,14 +51,14 @@ class TestSalesOrder(unittest.TestCase):
so.submit()
si = make_sales_invoice(so.name)
self.assertEquals(len(si.get("items")), len(so.get("items")))
self.assertEquals(len(si.get("items")), 1)
self.assertEqual(len(si.get("items")), len(so.get("items")))
self.assertEqual(len(si.get("items")), 1)
si.insert()
si.submit()
si1 = make_sales_invoice(so.name)
self.assertEquals(len(si1.get("items")), 0)
self.assertEqual(len(si1.get("items")), 0)
def test_make_sales_invoice_with_terms(self):
so = make_sales_order(do_not_submit=True)
@ -71,8 +71,8 @@ class TestSalesOrder(unittest.TestCase):
so.submit()
si = make_sales_invoice(so.name)
self.assertEquals(len(si.get("items")), len(so.get("items")))
self.assertEquals(len(si.get("items")), 1)
self.assertEqual(len(si.get("items")), len(so.get("items")))
self.assertEqual(len(si.get("items")), 1)
si.insert()
@ -84,7 +84,7 @@ class TestSalesOrder(unittest.TestCase):
si.submit()
si1 = make_sales_invoice(so.name)
self.assertEquals(len(si1.get("items")), 0)
self.assertEqual(len(si1.get("items")), 0)
def test_update_qty(self):
so = make_sales_order()
@ -92,7 +92,7 @@ class TestSalesOrder(unittest.TestCase):
create_dn_against_so(so.name, 6)
so.load_from_db()
self.assertEquals(so.get("items")[0].delivered_qty, 6)
self.assertEqual(so.get("items")[0].delivered_qty, 6)
# Check delivered_qty after make_sales_invoice without update_stock checked
si1 = make_sales_invoice(so.name)
@ -101,7 +101,7 @@ class TestSalesOrder(unittest.TestCase):
si1.submit()
so.load_from_db()
self.assertEquals(so.get("items")[0].delivered_qty, 6)
self.assertEqual(so.get("items")[0].delivered_qty, 6)
# Check delivered_qty after make_sales_invoice with update_stock checked
si2 = make_sales_invoice(so.name)
@ -111,7 +111,7 @@ class TestSalesOrder(unittest.TestCase):
si2.submit()
so.load_from_db()
self.assertEquals(so.get("items")[0].delivered_qty, 9)
self.assertEqual(so.get("items")[0].delivered_qty, 9)
def test_reserved_qty_for_partial_delivery(self):
make_stock_entry(target="_Test Warehouse - _TC", qty=10, rate=100)
@ -342,7 +342,7 @@ class TestSalesOrder(unittest.TestCase):
make_sales_order(item_code = "_Test Item for Auto Price List", selling_price_list="_Test Price List", rate=100)
self.assertEquals(frappe.db.get_value("Item Price",
self.assertEqual(frappe.db.get_value("Item Price",
{"price_list": "_Test Price List", "item_code": "_Test Item for Auto Price List"}, "price_list_rate"), 100)
@ -356,7 +356,7 @@ class TestSalesOrder(unittest.TestCase):
make_sales_order(item_code = "_Test Item for Auto Price List", selling_price_list="_Test Price List", rate=100)
self.assertEquals(frappe.db.get_value("Item Price",
self.assertEqual(frappe.db.get_value("Item Price",
{"price_list": "_Test Price List", "item_code": "_Test Item for Auto Price List"}, "price_list_rate"), None)
frappe.db.set_value("Stock Settings", None, "auto_insert_price_list_rate_if_missing", 1)
@ -419,10 +419,10 @@ class TestSalesOrder(unittest.TestCase):
dn = create_dn_against_so(so.name, delivered_qty=1)
self.assertEquals(so.customer, po.customer)
self.assertEquals(po.items[0].sales_order, so.name)
self.assertEquals(po.items[0].item_code, po_item.item_code)
self.assertEquals(dn.items[0].item_code, dn_item.item_code)
self.assertEqual(so.customer, po.customer)
self.assertEqual(po.items[0].sales_order, so.name)
self.assertEqual(po.items[0].item_code, po_item.item_code)
self.assertEqual(dn.items[0].item_code, dn_item.item_code)
#test ordered_qty and reserved_qty
bin = frappe.get_all("Bin", filters={"item_code": po_item.item_code, "warehouse": "_Test Warehouse - _TC"},
@ -431,27 +431,27 @@ class TestSalesOrder(unittest.TestCase):
ordered_qty = bin[0].ordered_qty if bin else 0.0
reserved_qty = bin[0].reserved_qty if bin else 0.0
self.assertEquals(abs(flt(ordered_qty)), existing_ordered_qty)
self.assertEquals(abs(flt(reserved_qty)), existing_reserved_qty)
self.assertEqual(abs(flt(ordered_qty)), existing_ordered_qty)
self.assertEqual(abs(flt(reserved_qty)), existing_reserved_qty)
reserved_qty = frappe.db.get_value("Bin",
{"item_code": dn_item.item_code, "warehouse": "_Test Warehouse - _TC"}, "reserved_qty")
self.assertEquals(abs(flt(reserved_qty)), existing_reserved_qty_for_dn_item + 1)
self.assertEqual(abs(flt(reserved_qty)), existing_reserved_qty_for_dn_item + 1)
#test po_item length
self.assertEquals(len(po.items), 1)
self.assertEqual(len(po.items), 1)
#test per_delivered status
update_status("Delivered", po.name)
self.assertEquals(flt(frappe.db.get_value("Sales Order", so.name, "per_delivered"), 2), 75.00)
self.assertEqual(flt(frappe.db.get_value("Sales Order", so.name, "per_delivered"), 2), 75.00)
#test reserved qty after complete delivery
dn = create_dn_against_so(so.name, delivered_qty=1)
reserved_qty = frappe.db.get_value("Bin",
{"item_code": dn_item.item_code, "warehouse": "_Test Warehouse - _TC"}, "reserved_qty")
self.assertEquals(abs(flt(reserved_qty)), existing_reserved_qty_for_dn_item)
self.assertEqual(abs(flt(reserved_qty)), existing_reserved_qty_for_dn_item)
#test after closing so
so.db_set('status', "Closed")
@ -463,13 +463,13 @@ class TestSalesOrder(unittest.TestCase):
ordered_qty = bin[0].ordered_qty if bin else 0.0
reserved_qty = bin[0].reserved_qty if bin else 0.0
self.assertEquals(abs(flt(ordered_qty)), existing_ordered_qty)
self.assertEquals(abs(flt(reserved_qty)), existing_reserved_qty)
self.assertEqual(abs(flt(ordered_qty)), existing_ordered_qty)
self.assertEqual(abs(flt(reserved_qty)), existing_reserved_qty)
reserved_qty = frappe.db.get_value("Bin",
{"item_code": dn_item.item_code, "warehouse": "_Test Warehouse - _TC"}, "reserved_qty")
self.assertEquals(abs(flt(reserved_qty)), existing_reserved_qty_for_dn_item)
self.assertEqual(abs(flt(reserved_qty)), existing_reserved_qty_for_dn_item)
def test_reserved_qty_for_closing_so(self):
bin = frappe.get_all("Bin", filters={"item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC"},
@ -479,11 +479,11 @@ class TestSalesOrder(unittest.TestCase):
so = make_sales_order(item_code="_Test Item", qty=1)
self.assertEquals(get_reserved_qty(item_code="_Test Item", warehouse="_Test Warehouse - _TC"), existing_reserved_qty+1)
self.assertEqual(get_reserved_qty(item_code="_Test Item", warehouse="_Test Warehouse - _TC"), existing_reserved_qty+1)
so.update_status("Closed")
self.assertEquals(get_reserved_qty(item_code="_Test Item", warehouse="_Test Warehouse - _TC"), existing_reserved_qty)
self.assertEqual(get_reserved_qty(item_code="_Test Item", warehouse="_Test Warehouse - _TC"), existing_reserved_qty)
def test_create_so_with_margin(self):
so = make_sales_order(item_code="_Test Item", qty=1, do_not_submit=True)
@ -495,13 +495,13 @@ class TestSalesOrder(unittest.TestCase):
new_so = frappe.copy_doc(so)
new_so.save(ignore_permissions=True)
self.assertEquals(new_so.get("items")[0].rate, flt((price_list_rate*25)/100 + price_list_rate))
self.assertEqual(new_so.get("items")[0].rate, flt((price_list_rate*25)/100 + price_list_rate))
new_so.items[0].margin_rate_or_amount = 25
new_so.payment_schedule = []
new_so.save()
new_so.submit()
self.assertEquals(new_so.get("items")[0].rate, flt((price_list_rate*25)/100 + price_list_rate))
self.assertEqual(new_so.get("items")[0].rate, flt((price_list_rate*25)/100 + price_list_rate))
def test_terms_auto_added(self):
so = make_sales_order(do_not_save=1)
@ -562,7 +562,7 @@ class TestSalesOrder(unittest.TestCase):
# Check if Production Orders were raised
for item in so_item_name:
po_qty = frappe.db.sql("select sum(qty) from `tabProduction Order` where sales_order=%s and sales_order_item=%s", (so.name, item))
self.assertEquals(po_qty[0][0], so_item_name.get(item))
self.assertEqual(po_qty[0][0], so_item_name.get(item))
def make_sales_order(**args):
so = frappe.new_doc("Sales Order")

View File

@ -93,10 +93,10 @@ class TestItem(unittest.TestCase):
new_lft, new_rgt = frappe.db.get_value("Item Group", "_Test Item Group C", ["lft", "rgt"])
# lft should reduce
self.assertEquals(old_lft - new_lft, rgt - lft + 1)
self.assertEqual(old_lft - new_lft, rgt - lft + 1)
# adjacent siblings, hence rgt diff will be 0
self.assertEquals(new_rgt - old_rgt, 0)
self.assertEqual(new_rgt - old_rgt, 0)
self.move_it_back()
@ -129,10 +129,10 @@ class TestItem(unittest.TestCase):
new_lft, new_rgt = frappe.db.get_value("Item Group", "_Test Item Group C", ["lft", "rgt"])
# lft should remain the same
self.assertEquals(old_lft - new_lft, 0)
self.assertEqual(old_lft - new_lft, 0)
# rgt should increase
self.assertEquals(new_rgt - old_rgt, rgt - lft + 1)
self.assertEqual(new_rgt - old_rgt, rgt - lft + 1)
# move it back
group_b_3 = frappe.get_doc("Item Group", "_Test Item Group B - 3")
@ -157,7 +157,7 @@ class TestItem(unittest.TestCase):
# rgt of each ancestor would reduce by 2
for item_group in ancestors:
new_lft, new_rgt = frappe.db.get_value("Item Group", item_group.name, ["lft", "rgt"])
self.assertEquals(new_rgt, item_group.rgt - 2)
self.assertEqual(new_rgt, item_group.rgt - 2)
# insert it back
frappe.copy_doc(test_records[6]).insert()

View File

@ -30,11 +30,11 @@ class TestShoppingCart(unittest.TestCase):
# test if lead is created and quotation with new lead is fetched
quotation = _get_cart_quotation()
self.assertEquals(quotation.quotation_to, "Customer")
self.assertEquals(quotation.contact_person,
self.assertEqual(quotation.quotation_to, "Customer")
self.assertEqual(quotation.contact_person,
frappe.db.get_value("Contact", dict(email_id="test_cart_user@example.com")))
self.assertEquals(quotation.lead, None)
self.assertEquals(quotation.contact_email, frappe.session.user)
self.assertEqual(quotation.lead, None)
self.assertEqual(quotation.contact_email, frappe.session.user)
return quotation
@ -43,10 +43,10 @@ class TestShoppingCart(unittest.TestCase):
# test if quotation with customer is fetched
quotation = _get_cart_quotation()
self.assertEquals(quotation.quotation_to, "Customer")
self.assertEquals(quotation.customer, "_Test Customer")
self.assertEquals(quotation.lead, None)
self.assertEquals(quotation.contact_email, frappe.session.user)
self.assertEqual(quotation.quotation_to, "Customer")
self.assertEqual(quotation.customer, "_Test Customer")
self.assertEqual(quotation.lead, None)
self.assertEqual(quotation.contact_email, frappe.session.user)
return quotation
@ -61,18 +61,18 @@ class TestShoppingCart(unittest.TestCase):
quotation = self.test_get_cart_customer()
self.assertEquals(quotation.get("items")[0].item_code, "_Test Item")
self.assertEquals(quotation.get("items")[0].qty, 1)
self.assertEquals(quotation.get("items")[0].amount, 10)
self.assertEqual(quotation.get("items")[0].item_code, "_Test Item")
self.assertEqual(quotation.get("items")[0].qty, 1)
self.assertEqual(quotation.get("items")[0].amount, 10)
# add second item
update_cart("_Test Item 2", 1)
quotation = self.test_get_cart_customer()
self.assertEquals(quotation.get("items")[1].item_code, "_Test Item 2")
self.assertEquals(quotation.get("items")[1].qty, 1)
self.assertEquals(quotation.get("items")[1].amount, 20)
self.assertEqual(quotation.get("items")[1].item_code, "_Test Item 2")
self.assertEqual(quotation.get("items")[1].qty, 1)
self.assertEqual(quotation.get("items")[1].amount, 20)
self.assertEquals(len(quotation.get("items")), 2)
self.assertEqual(len(quotation.get("items")), 2)
def test_update_cart(self):
# first, add to cart
@ -81,11 +81,11 @@ class TestShoppingCart(unittest.TestCase):
# update first item
update_cart("_Test Item", 5)
quotation = self.test_get_cart_customer()
self.assertEquals(quotation.get("items")[0].item_code, "_Test Item")
self.assertEquals(quotation.get("items")[0].qty, 5)
self.assertEquals(quotation.get("items")[0].amount, 50)
self.assertEquals(quotation.net_total, 70)
self.assertEquals(len(quotation.get("items")), 2)
self.assertEqual(quotation.get("items")[0].item_code, "_Test Item")
self.assertEqual(quotation.get("items")[0].qty, 5)
self.assertEqual(quotation.get("items")[0].amount, 50)
self.assertEqual(quotation.net_total, 70)
self.assertEqual(len(quotation.get("items")), 2)
def test_remove_from_cart(self):
# first, add to cart
@ -95,11 +95,11 @@ class TestShoppingCart(unittest.TestCase):
update_cart("_Test Item", 0)
quotation = self.test_get_cart_customer()
self.assertEquals(quotation.get("items")[0].item_code, "_Test Item 2")
self.assertEquals(quotation.get("items")[0].qty, 1)
self.assertEquals(quotation.get("items")[0].amount, 20)
self.assertEquals(quotation.net_total, 20)
self.assertEquals(len(quotation.get("items")), 1)
self.assertEqual(quotation.get("items")[0].item_code, "_Test Item 2")
self.assertEqual(quotation.get("items")[0].qty, 1)
self.assertEqual(quotation.get("items")[0].amount, 20)
self.assertEqual(quotation.net_total, 20)
self.assertEqual(len(quotation.get("items")), 1)
def test_tax_rule(self):
self.login_as_customer()
@ -111,8 +111,8 @@ class TestShoppingCart(unittest.TestCase):
quotation.transaction_date, quotation.company, None, None, \
quotation.customer_address, quotation.shipping_address_name, 1)
self.assertEquals(quotation.taxes_and_charges, tax_rule_master)
self.assertEquals(quotation.total_taxes_and_charges, 1000.0)
self.assertEqual(quotation.taxes_and_charges, tax_rule_master)
self.assertEqual(quotation.total_taxes_and_charges, 1000.0)
self.remove_test_quotation(quotation)

View File

@ -43,7 +43,7 @@ class TestBatch(unittest.TestCase):
receipt.submit()
self.assertTrue(receipt.items[0].batch_no)
self.assertEquals(get_batch_qty(receipt.items[0].batch_no,
self.assertEqual(get_batch_qty(receipt.items[0].batch_no,
receipt.items[0].warehouse), batch_qty)
return receipt
@ -70,7 +70,7 @@ class TestBatch(unittest.TestCase):
stock_entry.submit()
self.assertTrue(stock_entry.items[0].batch_no)
self.assertEquals(get_batch_qty(stock_entry.items[0].batch_no, stock_entry.items[0].t_warehouse), 90)
self.assertEqual(get_batch_qty(stock_entry.items[0].batch_no, stock_entry.items[0].t_warehouse), 90)
def test_delivery_note(self):
'''Test automatic batch selection for outgoing items'''
@ -94,7 +94,7 @@ class TestBatch(unittest.TestCase):
delivery_note.submit()
# shipped from FEFO batch
self.assertEquals(
self.assertEqual(
delivery_note.items[0].batch_no,
get_batch_no(item_code, receipt.items[0].warehouse, batch_qty)
)
@ -151,8 +151,8 @@ class TestBatch(unittest.TestCase):
new_batch = split_batch(receipt.items[0].batch_no, 'ITEM-BATCH-1', receipt.items[0].warehouse, 22)
self.assertEquals(get_batch_qty(receipt.items[0].batch_no, receipt.items[0].warehouse), 78)
self.assertEquals(get_batch_qty(new_batch, receipt.items[0].warehouse), 22)
self.assertEqual(get_batch_qty(receipt.items[0].batch_no, receipt.items[0].warehouse), 78)
self.assertEqual(get_batch_qty(new_batch, receipt.items[0].warehouse), 22)
def test_get_batch_qty(self):
'''Test getting batch quantities by batch_numbers, item_code or warehouse'''
@ -160,10 +160,10 @@ class TestBatch(unittest.TestCase):
self.make_new_batch_and_entry('ITEM-BATCH-2', 'batch a', '_Test Warehouse - _TC')
self.make_new_batch_and_entry('ITEM-BATCH-2', 'batch b', '_Test Warehouse - _TC')
self.assertEquals(get_batch_qty(item_code = 'ITEM-BATCH-2', warehouse = '_Test Warehouse - _TC'),
self.assertEqual(get_batch_qty(item_code = 'ITEM-BATCH-2', warehouse = '_Test Warehouse - _TC'),
[{'batch_no': u'batch a', 'qty': 90.0}, {'batch_no': u'batch b', 'qty': 90.0}])
self.assertEquals(get_batch_qty('batch a', '_Test Warehouse - _TC'), 90)
self.assertEqual(get_batch_qty('batch a', '_Test Warehouse - _TC'), 90)
@classmethod
def make_new_batch_and_entry(cls, item_name, batch_name, warehouse):

View File

@ -41,7 +41,7 @@ class TestDeliveryNote(unittest.TestCase):
dn.submit()
si = make_sales_invoice(dn.name)
self.assertEquals(len(si.get("items")), len(dn.get("items")))
self.assertEqual(len(si.get("items")), len(dn.get("items")))
# modify amount
si.get("items")[0].rate = 200
@ -91,11 +91,11 @@ class TestDeliveryNote(unittest.TestCase):
"Cost of Goods Sold - _TC": [stock_value_difference, 0.0]
}
for i, gle in enumerate(gl_entries):
self.assertEquals([gle.debit, gle.credit], expected_values.get(gle.account))
self.assertEqual([gle.debit, gle.credit], expected_values.get(gle.account))
# check stock in hand balance
bal = get_balance_on(stock_in_hand_account)
self.assertEquals(bal, prev_bal - stock_value_difference)
self.assertEqual(bal, prev_bal - stock_value_difference)
# back dated incoming entry
make_stock_entry(posting_date=add_days(nowdate(), -2), target="_Test Warehouse - _TC",
@ -112,7 +112,7 @@ class TestDeliveryNote(unittest.TestCase):
"Cost of Goods Sold - _TC": [stock_value_difference, 0.0]
}
for i, gle in enumerate(gl_entries):
self.assertEquals([gle.debit, gle.credit], expected_values.get(gle.account))
self.assertEqual([gle.debit, gle.credit], expected_values.get(gle.account))
dn.cancel()
self.assertFalse(get_gl_entries("Delivery Note", dn.name))
@ -149,11 +149,11 @@ class TestDeliveryNote(unittest.TestCase):
"Cost of Goods Sold - _TC": [stock_value_diff, 0.0]
}
for i, gle in enumerate(gl_entries):
self.assertEquals([gle.debit, gle.credit], expected_values.get(gle.account))
self.assertEqual([gle.debit, gle.credit], expected_values.get(gle.account))
# check stock in hand balance
bal = get_balance_on(stock_in_hand_account)
self.assertEquals(flt(bal, 2), flt(prev_bal - stock_value_diff, 2))
self.assertEqual(flt(bal, 2), flt(prev_bal - stock_value_diff, 2))
dn.cancel()
self.assertFalse(get_gl_entries("Delivery Note", dn.name))
@ -173,7 +173,7 @@ class TestDeliveryNote(unittest.TestCase):
si = make_sales_invoice(dn.name)
si.insert(ignore_permissions=True)
self.assertEquals(dn.items[0].serial_no, si.items[0].serial_no)
self.assertEqual(dn.items[0].serial_no, si.items[0].serial_no)
dn.cancel()
@ -192,11 +192,11 @@ class TestDeliveryNote(unittest.TestCase):
si = make_sales_invoice(dn.name)
si.items[0].qty = 1
si.submit()
self.assertEquals(si.items[0].qty, 1)
self.assertEqual(si.items[0].qty, 1)
si = make_sales_invoice(dn.name)
si.submit()
self.assertEquals(si.items[0].qty, len(get_serial_nos(si.items[0].serial_no)))
self.assertEqual(si.items[0].qty, len(get_serial_nos(si.items[0].serial_no)))
def test_serialize_status(self):
from frappe.model.naming import make_autoname
@ -215,7 +215,7 @@ class TestDeliveryNote(unittest.TestCase):
def check_serial_no_values(self, serial_no, field_values):
serial_no = frappe.get_doc("Serial No", serial_no)
for field, value in field_values.items():
self.assertEquals(cstr(serial_no.get(field)), value)
self.assertEqual(cstr(serial_no.get(field)), value)
def test_sales_return_for_non_bundled_items(self):
company = frappe.db.get_value('Warehouse', '_Test Warehouse - _TC', 'company')
@ -228,7 +228,7 @@ class TestDeliveryNote(unittest.TestCase):
dn = create_delivery_note(qty=5, rate=500)
actual_qty_1 = get_qty_after_transaction()
self.assertEquals(actual_qty_0 - 5, actual_qty_1)
self.assertEqual(actual_qty_0 - 5, actual_qty_1)
# outgoing_rate
outgoing_rate = frappe.db.get_value("Stock Ledger Entry", {"voucher_type": "Delivery Note",
@ -239,19 +239,19 @@ class TestDeliveryNote(unittest.TestCase):
actual_qty_2 = get_qty_after_transaction()
self.assertEquals(actual_qty_1 + 2, actual_qty_2)
self.assertEqual(actual_qty_1 + 2, actual_qty_2)
incoming_rate, stock_value_difference = frappe.db.get_value("Stock Ledger Entry",
{"voucher_type": "Delivery Note", "voucher_no": dn1.name},
["incoming_rate", "stock_value_difference"])
self.assertEquals(flt(incoming_rate, 3), abs(flt(outgoing_rate, 3)))
self.assertEqual(flt(incoming_rate, 3), abs(flt(outgoing_rate, 3)))
stock_in_hand_account = get_inventory_account('_Test Company', dn1.items[0].warehouse)
gle_warehouse_amount = frappe.db.get_value("GL Entry", {"voucher_type": "Delivery Note",
"voucher_no": dn1.name, "account": stock_in_hand_account}, "debit")
self.assertEquals(gle_warehouse_amount, stock_value_difference)
self.assertEqual(gle_warehouse_amount, stock_value_difference)
set_perpetual_inventory(0, company)
@ -267,7 +267,7 @@ class TestDeliveryNote(unittest.TestCase):
# Qty after delivery
actual_qty_1 = get_qty_after_transaction()
self.assertEquals(actual_qty_1, 25)
self.assertEqual(actual_qty_1, 25)
# outgoing_rate
outgoing_rate = frappe.db.get_value("Stock Ledger Entry", {"voucher_type": "Delivery Note",
@ -278,21 +278,21 @@ class TestDeliveryNote(unittest.TestCase):
# qty after return
actual_qty_2 = get_qty_after_transaction()
self.assertEquals(actual_qty_2, 35)
self.assertEqual(actual_qty_2, 35)
# Check incoming rate for return entry
incoming_rate, stock_value_difference = frappe.db.get_value("Stock Ledger Entry",
{"voucher_type": "Delivery Note", "voucher_no": dn1.name},
["incoming_rate", "stock_value_difference"])
self.assertEquals(flt(incoming_rate, 3), abs(flt(outgoing_rate, 3)))
self.assertEqual(flt(incoming_rate, 3), abs(flt(outgoing_rate, 3)))
stock_in_hand_account = get_inventory_account('_Test Company', dn1.items[0].warehouse)
# Check gl entry for warehouse
gle_warehouse_amount = frappe.db.get_value("GL Entry", {"voucher_type": "Delivery Note",
"voucher_no": dn1.name, "account": stock_in_hand_account}, "debit")
self.assertEquals(gle_warehouse_amount, stock_value_difference)
self.assertEqual(gle_warehouse_amount, stock_value_difference)
set_perpetual_inventory(0, company)
@ -306,14 +306,14 @@ class TestDeliveryNote(unittest.TestCase):
target="_Test Warehouse - _TC", qty=50, rate=100)
actual_qty = get_qty_after_transaction()
self.assertEquals(actual_qty, 50)
self.assertEqual(actual_qty, 50)
dn = create_delivery_note(item_code="_Test Product Bundle Item",
qty=5, rate=500)
# qty after return
actual_qty = get_qty_after_transaction()
self.assertEquals(actual_qty, 25)
self.assertEqual(actual_qty, 25)
# return bundled item
dn1 = create_delivery_note(item_code='_Test Product Bundle Item', is_return=1,
@ -321,21 +321,21 @@ class TestDeliveryNote(unittest.TestCase):
# qty after return
actual_qty = get_qty_after_transaction()
self.assertEquals(actual_qty, 35)
self.assertEqual(actual_qty, 35)
# Check incoming rate for return entry
incoming_rate, stock_value_difference = frappe.db.get_value("Stock Ledger Entry",
{"voucher_type": "Delivery Note", "voucher_no": dn1.name},
["incoming_rate", "stock_value_difference"])
self.assertEquals(incoming_rate, 100)
self.assertEqual(incoming_rate, 100)
stock_in_hand_account = get_inventory_account('_Test Company', dn1.items[0].warehouse)
# Check gl entry for warehouse
gle_warehouse_amount = frappe.db.get_value("GL Entry", {"voucher_type": "Delivery Note",
"voucher_no": dn1.name, "account": stock_in_hand_account}, "debit")
self.assertEquals(gle_warehouse_amount, 1400)
self.assertEqual(gle_warehouse_amount, 1400)
set_perpetual_inventory(0, company)
@ -395,10 +395,10 @@ class TestDeliveryNote(unittest.TestCase):
# qty after delivery
actual_qty = get_qty_after_transaction(warehouse="_Test Warehouse - _TC")
self.assertEquals(actual_qty, 75)
self.assertEqual(actual_qty, 75)
actual_qty = get_qty_after_transaction(warehouse="_Test Warehouse 1 - _TC")
self.assertEquals(actual_qty, opening_qty_test_warehouse_1 + 25)
self.assertEqual(actual_qty, opening_qty_test_warehouse_1 + 25)
# stock value diff for source warehouse
# for "_Test Item"
@ -413,7 +413,7 @@ class TestDeliveryNote(unittest.TestCase):
"item_code": "_Test Item", "warehouse": "_Test Warehouse 1 - _TC"},
"stock_value_difference")
self.assertEquals(abs(stock_value_difference), stock_value_difference1)
self.assertEqual(abs(stock_value_difference), stock_value_difference1)
# for "_Test Item Home Desktop 100"
stock_value_difference = frappe.db.get_value("Stock Ledger Entry",
@ -427,7 +427,7 @@ class TestDeliveryNote(unittest.TestCase):
"item_code": "_Test Item Home Desktop 100", "warehouse": "_Test Warehouse 1 - _TC"},
"stock_value_difference")
self.assertEquals(abs(stock_value_difference), stock_value_difference1)
self.assertEqual(abs(stock_value_difference), stock_value_difference1)
# Check gl entries
gl_entries = get_gl_entries("Delivery Note", dn.name)
@ -442,7 +442,7 @@ class TestDeliveryNote(unittest.TestCase):
"_Test Warehouse 1 - _TC": [stock_value_difference, 0.0]
}
for i, gle in enumerate(gl_entries):
self.assertEquals([gle.debit, gle.credit], expected_values.get(gle.account))
self.assertEqual([gle.debit, gle.credit], expected_values.get(gle.account))
set_perpetual_inventory(0, company)
@ -453,7 +453,7 @@ class TestDeliveryNote(unittest.TestCase):
dn.submit()
update_delivery_note_status(dn.name, "Closed")
self.assertEquals(frappe.db.get_value("Delivery Note", dn.name, "Status"), "Closed")
self.assertEqual(frappe.db.get_value("Delivery Note", dn.name, "Status"), "Closed")
def test_dn_billing_status_case1(self):
# SO -> DN -> SI

View File

@ -38,7 +38,7 @@ class TestDeliveryTrip(unittest.TestCase):
vehicle=delivery_trip.vehicle,
sender_email=sender_email, delivery_notification=delivery_trip.delivery_notification)
self.assertEquals(delivery_trip.get("delivery_stops")[0].notified_by_email, 0)
self.assertEqual(delivery_trip.get("delivery_stops")[0].notified_by_email, 0)
def create_driver():
if not frappe.db.exists("Driver", "Newton Scmander"):

View File

@ -100,7 +100,7 @@ class TestItem(unittest.TestCase):
})
for key, value in iteritems(to_check):
self.assertEquals(value, details.get(key))
self.assertEqual(value, details.get(key))
def test_item_attribute_change_after_variant(self):
frappe.delete_doc_if_exists("Item", "_Test Variant Item-L", force=1)
@ -155,7 +155,7 @@ class TestItem(unittest.TestCase):
variant = frappe.get_doc('Item', '_Test Variant Item-XL')
for fieldname in allow_fields:
self.assertEquals(template.get(fieldname), variant.get(fieldname))
self.assertEqual(template.get(fieldname), variant.get(fieldname))
template = frappe.get_doc('Item', '_Test Variant Item')
template.item_group = "_Test Item Group Desktops"
@ -205,14 +205,14 @@ class TestItem(unittest.TestCase):
variant = create_variant("_Test Numeric Template Item",
{"Test Size": "Large", "Test Item Length": 1.1})
self.assertEquals(variant.item_code, "_Test Numeric Template Item-L-1.1")
self.assertEqual(variant.item_code, "_Test Numeric Template Item-L-1.1")
variant.item_code = "_Test Numeric Variant-L-1.1"
variant.item_name = "_Test Numeric Variant Large 1.1m"
self.assertRaises(InvalidItemAttributeValueError, variant.save)
variant = create_variant("_Test Numeric Template Item",
{"Test Size": "Large", "Test Item Length": 1.5})
self.assertEquals(variant.item_code, "_Test Numeric Template Item-L-1.5")
self.assertEqual(variant.item_code, "_Test Numeric Template Item-L-1.5")
variant.item_code = "_Test Numeric Variant-L-1.5"
variant.item_name = "_Test Numeric Variant Large 1.5m"
variant.save()
@ -261,17 +261,17 @@ class TestItem(unittest.TestCase):
)).insert()
variant = get_variant(template.name, manufacturer=manufacturer.name)
self.assertEquals(variant.item_code, '_Test Variant Mfg-1')
self.assertEquals(variant.description, '_Test Variant Mfg')
self.assertEquals(variant.manufacturer, 'MSG1')
self.assertEqual(variant.item_code, '_Test Variant Mfg-1')
self.assertEqual(variant.description, '_Test Variant Mfg')
self.assertEqual(variant.manufacturer, 'MSG1')
variant.insert()
variant = get_variant(template.name, manufacturer=manufacturer.name,
manufacturer_part_no='007')
self.assertEquals(variant.item_code, '_Test Variant Mfg-2')
self.assertEquals(variant.description, '_Test Variant Mfg')
self.assertEquals(variant.manufacturer, 'MSG1')
self.assertEquals(variant.manufacturer_part_no, '007')
self.assertEqual(variant.item_code, '_Test Variant Mfg-2')
self.assertEqual(variant.description, '_Test Variant Mfg')
self.assertEqual(variant.manufacturer, 'MSG1')
self.assertEqual(variant.manufacturer_part_no, '007')
def test_stock_exists_against_template_item(self):
stock_item = frappe.get_all('Stock Ledger Entry', fields = ["item_code"], limit=1)

View File

@ -29,7 +29,7 @@ class TestLandedCostVoucher(unittest.TestCase):
submit_landed_cost_voucher("Purchase Receipt", pr.name)
pr_lc_value = frappe.db.get_value("Purchase Receipt Item", {"parent": pr.name}, "landed_cost_voucher_amount")
self.assertEquals(pr_lc_value, 25.0)
self.assertEqual(pr_lc_value, 25.0)
last_sle_after_landed_cost = frappe.db.get_value("Stock Ledger Entry", {
"voucher_type": pr.doctype,
@ -66,8 +66,8 @@ class TestLandedCostVoucher(unittest.TestCase):
}
for gle in gl_entries:
self.assertEquals(expected_values[gle.account][0], gle.debit)
self.assertEquals(expected_values[gle.account][1], gle.credit)
self.assertEqual(expected_values[gle.account][0], gle.debit)
self.assertEqual(expected_values[gle.account][1], gle.credit)
set_perpetual_inventory(0)
@ -90,7 +90,7 @@ class TestLandedCostVoucher(unittest.TestCase):
pi_lc_value = frappe.db.get_value("Purchase Invoice Item", {"parent": pi.name},
"landed_cost_voucher_amount")
self.assertEquals(pi_lc_value, 50.0)
self.assertEqual(pi_lc_value, 50.0)
last_sle_after_landed_cost = frappe.db.get_value("Stock Ledger Entry", {
"voucher_type": pi.doctype,
@ -116,8 +116,8 @@ class TestLandedCostVoucher(unittest.TestCase):
}
for gle in gl_entries:
self.assertEquals(expected_values[gle.account][0], gle.debit)
self.assertEquals(expected_values[gle.account][1], gle.credit)
self.assertEqual(expected_values[gle.account][0], gle.debit)
self.assertEqual(expected_values[gle.account][1], gle.credit)
set_perpetual_inventory(0)
@ -137,8 +137,8 @@ class TestLandedCostVoucher(unittest.TestCase):
serial_no = frappe.db.get_value("Serial No", "SN001",
["warehouse", "purchase_rate"], as_dict=1)
self.assertEquals(serial_no.purchase_rate - serial_no_rate, 5.0)
self.assertEquals(serial_no.warehouse, "_Test Warehouse - _TC")
self.assertEqual(serial_no.purchase_rate - serial_no_rate, 5.0)
self.assertEqual(serial_no.warehouse, "_Test Warehouse - _TC")
set_perpetual_inventory(0)
@ -159,8 +159,8 @@ class TestLandedCostVoucher(unittest.TestCase):
lcv = submit_landed_cost_voucher("Purchase Receipt", pr.name, 123.22)
self.assertEquals(lcv.items[0].applicable_charges, 41.07)
self.assertEquals(lcv.items[2].applicable_charges, 41.08)
self.assertEqual(lcv.items[0].applicable_charges, 41.07)
self.assertEqual(lcv.items[2].applicable_charges, 41.08)
set_perpetual_inventory(0)

View File

@ -25,8 +25,8 @@ class TestMaterialRequest(unittest.TestCase):
mr.submit()
po = make_purchase_order(mr.name)
self.assertEquals(po.doctype, "Purchase Order")
self.assertEquals(len(po.get("items")), len(mr.get("items")))
self.assertEqual(po.doctype, "Purchase Order")
self.assertEqual(len(po.get("items")), len(mr.get("items")))
def test_make_supplier_quotation(self):
from erpnext.stock.doctype.material_request.material_request import make_supplier_quotation
@ -39,8 +39,8 @@ class TestMaterialRequest(unittest.TestCase):
mr.submit()
sq = make_supplier_quotation(mr.name)
self.assertEquals(sq.doctype, "Supplier Quotation")
self.assertEquals(len(sq.get("items")), len(mr.get("items")))
self.assertEqual(sq.doctype, "Supplier Quotation")
self.assertEqual(len(sq.get("items")), len(mr.get("items")))
def test_make_stock_entry(self):
@ -56,8 +56,8 @@ class TestMaterialRequest(unittest.TestCase):
mr.submit()
se = make_stock_entry(mr.name)
self.assertEquals(se.doctype, "Stock Entry")
self.assertEquals(len(se.get("items")), len(mr.get("items")))
self.assertEqual(se.doctype, "Stock Entry")
self.assertEqual(len(se.get("items")), len(mr.get("items")))
def _insert_stock_entry(self, qty1, qty2, warehouse = None ):
se = frappe.get_doc({
@ -197,9 +197,9 @@ class TestMaterialRequest(unittest.TestCase):
# check if per complete is None
mr.load_from_db()
self.assertEquals(mr.per_ordered, 0)
self.assertEquals(mr.get("items")[0].ordered_qty, 0)
self.assertEquals(mr.get("items")[1].ordered_qty, 0)
self.assertEqual(mr.per_ordered, 0)
self.assertEqual(mr.get("items")[0].ordered_qty, 0)
self.assertEqual(mr.get("items")[1].ordered_qty, 0)
# map a purchase order
from erpnext.stock.doctype.material_request.material_request import make_purchase_order
@ -231,28 +231,28 @@ class TestMaterialRequest(unittest.TestCase):
# check if per complete is as expected
mr.load_from_db()
self.assertEquals(mr.per_ordered, 50)
self.assertEquals(mr.get("items")[0].ordered_qty, 27.0)
self.assertEquals(mr.get("items")[1].ordered_qty, 1.5)
self.assertEqual(mr.per_ordered, 50)
self.assertEqual(mr.get("items")[0].ordered_qty, 27.0)
self.assertEqual(mr.get("items")[1].ordered_qty, 1.5)
current_requested_qty_item1 = self._get_requested_qty("_Test Item Home Desktop 100", "_Test Warehouse - _TC")
current_requested_qty_item2 = self._get_requested_qty("_Test Item Home Desktop 200", "_Test Warehouse - _TC")
self.assertEquals(current_requested_qty_item1, existing_requested_qty_item1 + 27.0)
self.assertEquals(current_requested_qty_item2, existing_requested_qty_item2 + 1.5)
self.assertEqual(current_requested_qty_item1, existing_requested_qty_item1 + 27.0)
self.assertEqual(current_requested_qty_item2, existing_requested_qty_item2 + 1.5)
po.cancel()
# check if per complete is as expected
mr.load_from_db()
self.assertEquals(mr.per_ordered, 0)
self.assertEquals(mr.get("items")[0].ordered_qty, 0)
self.assertEquals(mr.get("items")[1].ordered_qty, 0)
self.assertEqual(mr.per_ordered, 0)
self.assertEqual(mr.get("items")[0].ordered_qty, 0)
self.assertEqual(mr.get("items")[1].ordered_qty, 0)
current_requested_qty_item1 = self._get_requested_qty("_Test Item Home Desktop 100", "_Test Warehouse - _TC")
current_requested_qty_item2 = self._get_requested_qty("_Test Item Home Desktop 200", "_Test Warehouse - _TC")
self.assertEquals(current_requested_qty_item1, existing_requested_qty_item1 + 54.0)
self.assertEquals(current_requested_qty_item2, existing_requested_qty_item2 + 3.0)
self.assertEqual(current_requested_qty_item1, existing_requested_qty_item1 + 54.0)
self.assertEqual(current_requested_qty_item2, existing_requested_qty_item2 + 3.0)
def test_completed_qty_for_transfer(self):
existing_requested_qty_item1 = self._get_requested_qty("_Test Item Home Desktop 100", "_Test Warehouse - _TC")
@ -266,15 +266,15 @@ class TestMaterialRequest(unittest.TestCase):
# check if per complete is None
mr.load_from_db()
self.assertEquals(mr.per_ordered, 0)
self.assertEquals(mr.get("items")[0].ordered_qty, 0)
self.assertEquals(mr.get("items")[1].ordered_qty, 0)
self.assertEqual(mr.per_ordered, 0)
self.assertEqual(mr.get("items")[0].ordered_qty, 0)
self.assertEqual(mr.get("items")[1].ordered_qty, 0)
current_requested_qty_item1 = self._get_requested_qty("_Test Item Home Desktop 100", "_Test Warehouse - _TC")
current_requested_qty_item2 = self._get_requested_qty("_Test Item Home Desktop 200", "_Test Warehouse - _TC")
self.assertEquals(current_requested_qty_item1, existing_requested_qty_item1 + 54.0)
self.assertEquals(current_requested_qty_item2, existing_requested_qty_item2 + 3.0)
self.assertEqual(current_requested_qty_item1, existing_requested_qty_item1 + 54.0)
self.assertEqual(current_requested_qty_item2, existing_requested_qty_item2 + 3.0)
from erpnext.stock.doctype.material_request.material_request import make_stock_entry
@ -321,28 +321,28 @@ class TestMaterialRequest(unittest.TestCase):
# check if per complete is as expected
mr.load_from_db()
self.assertEquals(mr.per_ordered, 50)
self.assertEquals(mr.get("items")[0].ordered_qty, 27.0)
self.assertEquals(mr.get("items")[1].ordered_qty, 1.5)
self.assertEqual(mr.per_ordered, 50)
self.assertEqual(mr.get("items")[0].ordered_qty, 27.0)
self.assertEqual(mr.get("items")[1].ordered_qty, 1.5)
current_requested_qty_item1 = self._get_requested_qty("_Test Item Home Desktop 100", "_Test Warehouse - _TC")
current_requested_qty_item2 = self._get_requested_qty("_Test Item Home Desktop 200", "_Test Warehouse - _TC")
self.assertEquals(current_requested_qty_item1, existing_requested_qty_item1 + 27.0)
self.assertEquals(current_requested_qty_item2, existing_requested_qty_item2 + 1.5)
self.assertEqual(current_requested_qty_item1, existing_requested_qty_item1 + 27.0)
self.assertEqual(current_requested_qty_item2, existing_requested_qty_item2 + 1.5)
# check if per complete is as expected for Stock Entry cancelled
se.cancel()
mr.load_from_db()
self.assertEquals(mr.per_ordered, 0)
self.assertEquals(mr.get("items")[0].ordered_qty, 0)
self.assertEquals(mr.get("items")[1].ordered_qty, 0)
self.assertEqual(mr.per_ordered, 0)
self.assertEqual(mr.get("items")[0].ordered_qty, 0)
self.assertEqual(mr.get("items")[1].ordered_qty, 0)
current_requested_qty_item1 = self._get_requested_qty("_Test Item Home Desktop 100", "_Test Warehouse - _TC")
current_requested_qty_item2 = self._get_requested_qty("_Test Item Home Desktop 200", "_Test Warehouse - _TC")
self.assertEquals(current_requested_qty_item1, existing_requested_qty_item1 + 54.0)
self.assertEquals(current_requested_qty_item2, existing_requested_qty_item2 + 3.0)
self.assertEqual(current_requested_qty_item1, existing_requested_qty_item1 + 54.0)
self.assertEqual(current_requested_qty_item2, existing_requested_qty_item2 + 3.0)
def test_completed_qty_for_over_transfer(self):
existing_requested_qty_item1 = self._get_requested_qty("_Test Item Home Desktop 100", "_Test Warehouse - _TC")
@ -356,9 +356,9 @@ class TestMaterialRequest(unittest.TestCase):
# check if per complete is None
mr.load_from_db()
self.assertEquals(mr.per_ordered, 0)
self.assertEquals(mr.get("items")[0].ordered_qty, 0)
self.assertEquals(mr.get("items")[1].ordered_qty, 0)
self.assertEqual(mr.per_ordered, 0)
self.assertEqual(mr.get("items")[0].ordered_qty, 0)
self.assertEqual(mr.get("items")[1].ordered_qty, 0)
# map a stock entry
from erpnext.stock.doctype.material_request.material_request import make_stock_entry
@ -400,28 +400,28 @@ class TestMaterialRequest(unittest.TestCase):
# check if per complete is as expected
mr.load_from_db()
self.assertEquals(mr.per_ordered, 100)
self.assertEquals(mr.get("items")[0].ordered_qty, 54.0)
self.assertEquals(mr.get("items")[1].ordered_qty, 3.0)
self.assertEqual(mr.per_ordered, 100)
self.assertEqual(mr.get("items")[0].ordered_qty, 54.0)
self.assertEqual(mr.get("items")[1].ordered_qty, 3.0)
current_requested_qty_item1 = self._get_requested_qty("_Test Item Home Desktop 100", "_Test Warehouse - _TC")
current_requested_qty_item2 = self._get_requested_qty("_Test Item Home Desktop 200", "_Test Warehouse - _TC")
self.assertEquals(current_requested_qty_item1, existing_requested_qty_item1)
self.assertEquals(current_requested_qty_item2, existing_requested_qty_item2)
self.assertEqual(current_requested_qty_item1, existing_requested_qty_item1)
self.assertEqual(current_requested_qty_item2, existing_requested_qty_item2)
# check if per complete is as expected for Stock Entry cancelled
se.cancel()
mr.load_from_db()
self.assertEquals(mr.per_ordered, 0)
self.assertEquals(mr.get("items")[0].ordered_qty, 0)
self.assertEquals(mr.get("items")[1].ordered_qty, 0)
self.assertEqual(mr.per_ordered, 0)
self.assertEqual(mr.get("items")[0].ordered_qty, 0)
self.assertEqual(mr.get("items")[1].ordered_qty, 0)
current_requested_qty_item1 = self._get_requested_qty("_Test Item Home Desktop 100", "_Test Warehouse - _TC")
current_requested_qty_item2 = self._get_requested_qty("_Test Item Home Desktop 200", "_Test Warehouse - _TC")
self.assertEquals(current_requested_qty_item1, existing_requested_qty_item1 + 54.0)
self.assertEquals(current_requested_qty_item2, existing_requested_qty_item2 + 3.0)
self.assertEqual(current_requested_qty_item1, existing_requested_qty_item1 + 54.0)
self.assertEqual(current_requested_qty_item2, existing_requested_qty_item2 + 3.0)
def test_incorrect_mapping_of_stock_entry(self):
# submit material request of type Transfer
@ -466,7 +466,7 @@ class TestMaterialRequest(unittest.TestCase):
# map a stock entry
from erpnext.stock.doctype.material_request.material_request import make_stock_entry
se_doc = make_stock_entry(mr.name)
self.assertEquals(se_doc.get("items")[0].s_warehouse, "_Test Warehouse - _TC")
self.assertEqual(se_doc.get("items")[0].s_warehouse, "_Test Warehouse - _TC")
def test_warehouse_company_validation(self):
from erpnext.stock.utils import InvalidWarehouseCompany
@ -490,8 +490,8 @@ class TestMaterialRequest(unittest.TestCase):
mr.submit()
se = make_stock_entry(mr.name)
self.assertEquals(se.doctype, "Stock Entry")
self.assertEquals(len(se.get("items")), len(mr.get("items")))
self.assertEqual(se.doctype, "Stock Entry")
self.assertEqual(len(se.get("items")), len(mr.get("items")))
def test_completed_qty_for_issue(self):
def _get_requested_qty():
@ -507,7 +507,7 @@ class TestMaterialRequest(unittest.TestCase):
mr.submit()
#testing bin value after material request is submitted
self.assertEquals(_get_requested_qty(), existing_requested_qty + 54.0)
self.assertEqual(_get_requested_qty(), existing_requested_qty + 54.0)
# receive items to allow issue
self._insert_stock_entry(60, 6, "_Test Warehouse - _TC")
@ -522,11 +522,11 @@ class TestMaterialRequest(unittest.TestCase):
# check if per complete is as expected
mr.load_from_db()
self.assertEquals(mr.get("items")[0].ordered_qty, 54.0)
self.assertEquals(mr.get("items")[1].ordered_qty, 3.0)
self.assertEqual(mr.get("items")[0].ordered_qty, 54.0)
self.assertEqual(mr.get("items")[1].ordered_qty, 3.0)
#testing bin requested qty after issuing stock against material request
self.assertEquals(_get_requested_qty(), existing_requested_qty)
self.assertEqual(_get_requested_qty(), existing_requested_qty)
def test_material_request_type_manufacture(self):
mr = frappe.copy_doc(test_records[1]).insert()
@ -542,21 +542,21 @@ class TestMaterialRequest(unittest.TestCase):
po.submit()
mr = frappe.get_doc("Material Request", mr.name)
self.assertEquals(completed_qty + po.qty, mr.items[0].ordered_qty)
self.assertEqual(completed_qty + po.qty, mr.items[0].ordered_qty)
new_requested_qty = frappe.db.sql("""select indented_qty from `tabBin` where \
item_code= %s and warehouse= %s """, (mr.items[0].item_code, mr.items[0].warehouse))[0][0]
self.assertEquals(requested_qty - po.qty, new_requested_qty)
self.assertEqual(requested_qty - po.qty, new_requested_qty)
po.cancel()
mr = frappe.get_doc("Material Request", mr.name)
self.assertEquals(completed_qty, mr.items[0].ordered_qty)
self.assertEqual(completed_qty, mr.items[0].ordered_qty)
new_requested_qty = frappe.db.sql("""select indented_qty from `tabBin` where \
item_code= %s and warehouse= %s """, (mr.items[0].item_code, mr.items[0].warehouse))[0][0]
self.assertEquals(requested_qty, new_requested_qty)
self.assertEqual(requested_qty, new_requested_qty)
def test_multi_uom_for_purchase(self):
from erpnext.stock.doctype.material_request.material_request import make_purchase_order
@ -587,19 +587,19 @@ class TestMaterialRequest(unittest.TestCase):
mr.submit()
item = mr.items[0]
self.assertEquals(item.uom, "Kg")
self.assertEquals(item.conversion_factor, 5.0)
self.assertEquals(item.stock_qty, flt(item.qty * 5))
self.assertEqual(item.uom, "Kg")
self.assertEqual(item.conversion_factor, 5.0)
self.assertEqual(item.stock_qty, flt(item.qty * 5))
po = make_purchase_order(mr.name)
self.assertEquals(po.doctype, "Purchase Order")
self.assertEquals(len(po.get("items")), len(mr.get("items")))
self.assertEqual(po.doctype, "Purchase Order")
self.assertEqual(len(po.get("items")), len(mr.get("items")))
po.supplier = '_Test Supplier'
po.insert()
po.submit()
mr = frappe.get_doc("Material Request", mr.name)
self.assertEquals(mr.per_ordered, 100)
self.assertEqual(mr.per_ordered, 100)
test_dependencies = ["Currency Exchange", "BOM"]
test_records = frappe.get_test_records('Material Request')

View File

@ -24,8 +24,8 @@ class TestPurchaseReceipt(unittest.TestCase):
pi = make_purchase_invoice(pr.name)
self.assertEquals(pi.doctype, "Purchase Invoice")
self.assertEquals(len(pi.get("items")), len(pr.get("items")))
self.assertEqual(pi.doctype, "Purchase Invoice")
self.assertEqual(len(pi.get("items")), len(pr.get("items")))
# modify rate
pi.get("items")[0].rate = 200
@ -81,8 +81,8 @@ class TestPurchaseReceipt(unittest.TestCase):
}
for gle in gl_entries:
self.assertEquals(expected_values[gle.account][0], gle.debit)
self.assertEquals(expected_values[gle.account][1], gle.credit)
self.assertEqual(expected_values[gle.account][0], gle.debit)
self.assertEqual(expected_values[gle.account][1], gle.credit)
pr.cancel()
self.assertFalse(get_gl_entries("Purchase Receipt", pr.name))
@ -97,14 +97,14 @@ class TestPurchaseReceipt(unittest.TestCase):
qty=100, basic_rate=100)
pr = make_purchase_receipt(item_code="_Test FG Item", qty=10, rate=500, is_subcontracted="Yes")
self.assertEquals(len(pr.get("supplied_items")), 2)
self.assertEqual(len(pr.get("supplied_items")), 2)
rm_supp_cost = sum([d.amount for d in pr.get("supplied_items")])
self.assertEquals(pr.get("items")[0].rm_supp_cost, flt(rm_supp_cost, 2))
self.assertEqual(pr.get("items")[0].rm_supp_cost, flt(rm_supp_cost, 2))
def test_serial_no_supplier(self):
pr = make_purchase_receipt(item_code="_Test Serialized Item With Series", qty=1)
self.assertEquals(frappe.db.get_value("Serial No", pr.get("items")[0].serial_no, "supplier"),
self.assertEqual(frappe.db.get_value("Serial No", pr.get("items")[0].serial_no, "supplier"),
pr.supplier)
pr.cancel()
@ -121,15 +121,15 @@ class TestPurchaseReceipt(unittest.TestCase):
pr.submit()
accepted_serial_nos = pr.get("items")[0].serial_no.split("\n")
self.assertEquals(len(accepted_serial_nos), 3)
self.assertEqual(len(accepted_serial_nos), 3)
for serial_no in accepted_serial_nos:
self.assertEquals(frappe.db.get_value("Serial No", serial_no, "warehouse"),
self.assertEqual(frappe.db.get_value("Serial No", serial_no, "warehouse"),
pr.get("items")[0].warehouse)
rejected_serial_nos = pr.get("items")[0].rejected_serial_no.split("\n")
self.assertEquals(len(rejected_serial_nos), 2)
self.assertEqual(len(rejected_serial_nos), 2)
for serial_no in rejected_serial_nos:
self.assertEquals(frappe.db.get_value("Serial No", serial_no, "warehouse"),
self.assertEqual(frappe.db.get_value("Serial No", serial_no, "warehouse"),
pr.get("items")[0].rejected_warehouse)
def test_purchase_return(self):
@ -158,8 +158,8 @@ class TestPurchaseReceipt(unittest.TestCase):
}
for gle in gl_entries:
self.assertEquals(expected_values[gle.account][0], gle.debit)
self.assertEquals(expected_values[gle.account][1], gle.credit)
self.assertEqual(expected_values[gle.account][0], gle.debit)
self.assertEqual(expected_values[gle.account][1], gle.credit)
set_perpetual_inventory(0)
@ -181,7 +181,7 @@ class TestPurchaseReceipt(unittest.TestCase):
def _check_serial_no_values(serial_no, field_values):
serial_no = frappe.get_doc("Serial No", serial_no)
for field, value in field_values.items():
self.assertEquals(cstr(serial_no.get(field)), value)
self.assertEqual(cstr(serial_no.get(field)), value)
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
@ -210,7 +210,7 @@ class TestPurchaseReceipt(unittest.TestCase):
pr.submit()
update_purchase_receipt_status(pr.name, "Closed")
self.assertEquals(frappe.db.get_value("Purchase Receipt", pr.name, "status"), "Closed")
self.assertEqual(frappe.db.get_value("Purchase Receipt", pr.name, "status"), "Closed")
def test_pr_billing_status(self):
# PO -> PR1 -> PI and PO -> PI and PO -> PR2

View File

@ -310,9 +310,9 @@ class TestStockEntry(unittest.TestCase):
sle.sort(key=lambda x: x[0])
for i, sle in enumerate(sle):
self.assertEquals(expected_sle[i][0], sle[0])
self.assertEquals(expected_sle[i][1], sle[1])
self.assertEquals(expected_sle[i][2], sle[2])
self.assertEqual(expected_sle[i][0], sle[0])
self.assertEqual(expected_sle[i][1], sle[1])
self.assertEqual(expected_sle[i][2], sle[2])
def check_gl_entries(self, voucher_type, voucher_no, expected_gl_entries):
expected_gl_entries.sort(key=lambda x: x[0])
@ -324,9 +324,9 @@ class TestStockEntry(unittest.TestCase):
self.assertTrue(gl_entries)
gl_entries.sort(key=lambda x: x[0])
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_gl_entries[i][0], gle[0])
self.assertEquals(expected_gl_entries[i][1], gle[1])
self.assertEquals(expected_gl_entries[i][2], gle[2])
self.assertEqual(expected_gl_entries[i][0], gle[0])
self.assertEqual(expected_gl_entries[i][1], gle[1])
self.assertEqual(expected_gl_entries[i][2], gle[2])
def test_serial_no_not_reqd(self):
se = frappe.copy_doc(test_records[0])
@ -669,8 +669,8 @@ class TestStockEntry(unittest.TestCase):
qty_in_usable_warehouse = get_batch_qty(receipt_entry.get("items")[0].batch_no, "_Test Warehouse - _TC", "_Test Item")
qty_in_retention_warehouse = get_batch_qty(receipt_entry.get("items")[0].batch_no, "Test Warehouse for Sample Retention - _TC", "_Test Item")
self.assertEquals(qty_in_usable_warehouse, 36)
self.assertEquals(qty_in_retention_warehouse, 4)
self.assertEqual(qty_in_usable_warehouse, 36)
self.assertEqual(qty_in_retention_warehouse, 4)
def test_quality_check(self):
item_code = "_Test Item For QC"

View File

@ -33,7 +33,7 @@ class TestStockSettings(unittest.TestCase):
item.reload()
self.assertEquals(item.description, '<p>Drawing No. 07-xxx-PO132<br>1800 x 1685 x 750<br>All parts made of Marine Ply<br>Top w/ Corian dd<br>CO, CS, VIP Day Cabin</p>')
self.assertEqual(item.description, '<p>Drawing No. 07-xxx-PO132<br>1800 x 1685 x 750<br>All parts made of Marine Ply<br>Top w/ Corian dd<br>CO, CS, VIP Day Cabin</p>')
item.delete()
@ -49,6 +49,6 @@ class TestStockSettings(unittest.TestCase):
description = '<p><span style="font-size: 12px;">Drawing No. 07-xxx-PO132<br></span><span style="font-size: 12px;">1800 x 1685 x 750<br></span><span style="font-size: 12px;">All parts made of Marine Ply<br></span><span style="font-size: 12px;">Top w/ Corian dd<br></span><span style="font-size: 12px;">CO, CS, VIP Day Cabin</span></p>'
)).insert()
self.assertEquals(item.description, '<p>Drawing No. 07-xxx-PO132<br>1800 x 1685 x 750<br>All parts made of Marine Ply<br>Top w/ Corian dd<br>CO, CS, VIP Day Cabin</p>')
self.assertEqual(item.description, '<p>Drawing No. 07-xxx-PO132<br>1800 x 1685 x 750<br>All parts made of Marine Ply<br>Top w/ Corian dd<br>CO, CS, VIP Day Cabin</p>')
item.delete()

View File

@ -19,7 +19,7 @@ class TestWarehouse(unittest.TestCase):
def test_parent_warehouse(self):
parent_warehouse = frappe.get_doc("Warehouse", "_Test Warehouse Group - _TC")
self.assertEquals(parent_warehouse.is_group, 1)
self.assertEqual(parent_warehouse.is_group, 1)
def test_warehouse_hierarchy(self):
p_warehouse = frappe.get_doc("Warehouse", "_Test Warehouse Group - _TC")
@ -28,8 +28,8 @@ class TestWarehouse(unittest.TestCase):
where wh.lft > %s and wh.rgt < %s""", (p_warehouse.lft, p_warehouse.rgt), as_dict=1)
for child_warehouse in child_warehouses:
self.assertEquals(p_warehouse.name, child_warehouse.parent_warehouse)
self.assertEquals(child_warehouse.is_group, 0)
self.assertEqual(p_warehouse.name, child_warehouse.parent_warehouse)
self.assertEqual(child_warehouse.is_group, 0)
def test_warehouse_renaming(self):
set_perpetual_inventory(1)

View File

@ -42,5 +42,5 @@ class TestNotifications(unittest.TestCase):
config = notifications.get_notification_config()
doc_target_percents = notifications.get_notifications_for_targets(config, {})
self.assertEquals(doc_target_percents['Company']['_Test Company 7'], 10)
self.assertEquals(doc_target_percents['Company']['_Test Company 6'], 0)
self.assertEqual(doc_target_percents['Company']['_Test Company 7'], 10)
self.assertEqual(doc_target_percents['Company']['_Test Company 6'], 0)