mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-03 16:40:19 +00:00
refactor: resolve regression-safe CodeQL code-quality findings (#55531)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1288,8 +1288,6 @@ def make_asset_movement(
|
||||
assets: list[dict] | str,
|
||||
purpose: str = "Transfer",
|
||||
):
|
||||
import json
|
||||
|
||||
if isinstance(assets, str):
|
||||
assets = json.loads(assets)
|
||||
|
||||
|
||||
@@ -885,9 +885,9 @@ class TestAsset(AssetSetup):
|
||||
with self.assertRaises(frappe.ValidationError) as err:
|
||||
asset.save()
|
||||
|
||||
self.assertTrue(
|
||||
"Please set Depreciation related Accounts in Asset Category Computers or Company"
|
||||
in str(err.exception)
|
||||
self.assertIn(
|
||||
"Please set Depreciation related Accounts in Asset Category Computers or Company",
|
||||
str(err.exception),
|
||||
)
|
||||
finally:
|
||||
frappe.db.set_value("Company", "_Test Company", company_depreciation_accounts)
|
||||
@@ -1699,8 +1699,8 @@ class TestDepreciationBasics(AssetSetup):
|
||||
accumulated_depreciation_after_full_schedule
|
||||
)
|
||||
|
||||
self.assertTrue(
|
||||
asset.finance_books[0].expected_value_after_useful_life >= asset_value_after_full_schedule
|
||||
self.assertGreaterEqual(
|
||||
asset.finance_books[0].expected_value_after_useful_life, asset_value_after_full_schedule
|
||||
)
|
||||
|
||||
def test_gle_made_by_depreciation_entries(self):
|
||||
|
||||
@@ -72,7 +72,7 @@ class TestAssetCategory(ERPNextTestSuite):
|
||||
)
|
||||
with self.assertRaises(frappe.ValidationError) as err:
|
||||
asset_category.save()
|
||||
self.assertTrue("Cannot set multiple account rows for the same company" in str(err.exception))
|
||||
self.assertIn("Cannot set multiple account rows for the same company", str(err.exception))
|
||||
|
||||
def test_depreciation_accounts_required_for_existing_depreciable_assets(self):
|
||||
asset = create_asset(
|
||||
@@ -110,9 +110,9 @@ class TestAssetCategory(ERPNextTestSuite):
|
||||
with self.assertRaises(frappe.ValidationError) as err:
|
||||
asset_category.save()
|
||||
|
||||
self.assertTrue(
|
||||
"Since there are active depreciable assets under this category, the following accounts are required."
|
||||
in str(err.exception)
|
||||
self.assertIn(
|
||||
"Since there are active depreciable assets under this category, the following accounts are required.",
|
||||
str(err.exception),
|
||||
)
|
||||
finally:
|
||||
frappe.db.set_value("Company", asset.company, company_acccount_depreciation)
|
||||
|
||||
Reference in New Issue
Block a user