refactor: resolve regression-safe CodeQL code-quality findings (#55531)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Mihir Kandoi
2026-06-02 08:25:32 +05:30
committed by GitHub
parent 4611dd1c36
commit 78f9434d14
59 changed files with 219 additions and 258 deletions

View File

@@ -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)

View File

@@ -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):

View File

@@ -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)