We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent de0950b commit 8468fbdCopy full SHA for 8468fbd
1 file changed
sqlalchemy_mptt/tests/cases/integrity.py
@@ -97,10 +97,7 @@ def test_hierarchy_structure(self):
97
while nodes with left > self and right < self are considered descendants
98
"""
99
table = self.model
100
- tree_size = self.session.query(table).count()
101
-
102
- pivot_idx = tree_size // 2
103
- pivot = self.session.query(table).slice(pivot_idx, pivot_idx+1).one()
+ pivot = self.session.query(table).filter(table.right - table.left != 1).filter(table.parent_id != None).first()
104
105
# Exclusive Tests
106
ancestors = self.session.query(table).filter(table.is_ancestor_of(pivot)).all()
0 commit comments