From 2df0e405f3ee1feaa325a42a1e29a1dc2b4de047 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 15 Jul 2024 15:49:37 +0530 Subject: [PATCH 1/2] fix(test): incorrect linter fix from ruff --- .../report/gross_profit/test_gross_profit.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/report/gross_profit/test_gross_profit.py b/erpnext/accounts/report/gross_profit/test_gross_profit.py index 65b489d984..527e9ad3f7 100644 --- a/erpnext/accounts/report/gross_profit/test_gross_profit.py +++ b/erpnext/accounts/report/gross_profit/test_gross_profit.py @@ -433,8 +433,10 @@ class TestGrossProfit(FrappeTestCase): gp_entry = [x for x in data if x.parent_invoice == sinv.name] # Both items of Invoice should have '0' qty self.assertEqual(len(gp_entry), 2) - self.assertDictContainsSubset(expected_entry, gp_entry[0]) - self.assertDictContainsSubset(expected_entry, gp_entry[1]) + report_output = {k: v for k, v in gp_entry[0].items() if k in expected_entry} + self.assertEqual(report_output, expected_entry) + report_output = {k: v for k, v in gp_entry[1].items() if k in expected_entry} + self.assertEqual(report_output, expected_entry) def test_standalone_cr_notes(self): """ @@ -470,7 +472,8 @@ class TestGrossProfit(FrappeTestCase): "gross_profit_%": 100.0, } gp_entry = [x for x in data if x.parent_invoice == sinv.name] - self.assertDictContainsSubset(expected_entry, gp_entry[0]) + report_output = {k: v for k, v in gp_entry[0].items() if k in expected_entry} + self.assertEqual(report_output, expected_entry) def test_different_rates_in_si_and_dn(self): from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order @@ -562,7 +565,8 @@ class TestGrossProfit(FrappeTestCase): "gross_profit_%": 12.5, } gp_entry = [x for x in data if x.parent_invoice == sinv.name] - self.assertEqual(gp_entry[0], gp_entry[0] | expected_entry) + report_output = {k: v for k, v in gp_entry[0].items() if k in expected_entry} + self.assertEqual(report_output, expected_entry) def test_valuation_rate_without_previous_sle(self): """ -- GitLab From 53e518bf1a53db01c70360cebe6f6801ba24aa6e Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 15 Jul 2024 15:52:59 +0530 Subject: [PATCH 2/2] fix(test): incorrect ruff changes --- .../accounts/report/gross_profit/test_gross_profit.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/report/gross_profit/test_gross_profit.py b/erpnext/accounts/report/gross_profit/test_gross_profit.py index 527e9ad3f7..75a5f2ee8c 100644 --- a/erpnext/accounts/report/gross_profit/test_gross_profit.py +++ b/erpnext/accounts/report/gross_profit/test_gross_profit.py @@ -232,7 +232,8 @@ class TestGrossProfit(FrappeTestCase): "gross_profit_%": -50.0, } gp_entry = [x for x in data if x.parent_invoice == sinv.name] - self.assertDictContainsSubset(expected_entry_without_dn, gp_entry[0]) + report_output = {k: v for k, v in gp_entry[0].items() if k in expected_entry_without_dn} + self.assertEqual(report_output, expected_entry_without_dn) # make delivery note dn = make_delivery_note(sinv.name) @@ -260,7 +261,8 @@ class TestGrossProfit(FrappeTestCase): "gross_profit_%": 0.0, } gp_entry = [x for x in data if x.parent_invoice == sinv.name] - self.assertDictContainsSubset(expected_entry_with_dn, gp_entry[0]) + report_output = {k: v for k, v in gp_entry[0].items() if k in expected_entry_with_dn} + self.assertEqual(report_output, expected_entry_with_dn) def test_bundled_delivery_note_with_different_warehouses(self): """ @@ -391,7 +393,8 @@ class TestGrossProfit(FrappeTestCase): "gross_profit_%": -25.0, } gp_entry = [x for x in data if x.parent_invoice == sinv.name] - self.assertDictContainsSubset(expected_entry, gp_entry[0]) + report_output = {k: v for k, v in gp_entry[0].items() if k in expected_entry} + self.assertEqual(report_output, expected_entry) def test_crnote_against_invoice_with_multiple_instances_of_same_item(self): """ -- GitLab