refactor(test): make item group deterministic

'Item Group C' follows 'Item Group B'. So `lft` will increase while
`rgt` stays the same.
This commit is contained in:
ruthra kumar
2026-01-30 12:34:39 +05:30
parent 57f94b3ac2
commit ff87eedd96

View File

@@ -105,7 +105,6 @@ class TestItemGroup(ERPNextTestSuite):
old_lft, old_rgt = frappe.db.get_value("Item Group", "_Test Item Group C", ["lft", "rgt"])
group_b_3 = frappe.get_doc("Item Group", "_Test Item Group B - 3")
lft, rgt = group_b_3.lft, group_b_3.rgt
# child of right sibling is moved into it
group_b_3.parent_item_group = "_Test Item Group C"
@@ -115,10 +114,10 @@ class TestItemGroup(ERPNextTestSuite):
new_lft, new_rgt = frappe.db.get_value("Item Group", "_Test Item Group C", ["lft", "rgt"])
# lft should remain the same
self.assertEqual(old_lft - new_lft, 0)
self.assertEqual(old_lft - new_lft, 2)
# rgt should increase
self.assertEqual(new_rgt - old_rgt, rgt - lft + 1)
self.assertEqual(new_rgt - old_rgt, 0)
# move it back
group_b_3 = frappe.get_doc("Item Group", "_Test Item Group B - 3")