return x
path = self.parent_path(node)
- assert path[-1]
+ assert path[-1] is not None
assert path[-1] == node
path = path[:-1]
path.reverse()
for ancestor in path:
- assert ancestor
+ assert ancestor is not None
if node != ancestor.right:
return ancestor
node = ancestor