Add more detailed error messages for the RB assignment

This commit is contained in:
2026-07-21 20:13:27 -04:00
parent d488ac5575
commit 059c848d3d

View File

@@ -1,3 +1,5 @@
import traceback
class Node:
def __init__(self, value, left=None, right=None, parent=None, is_red=False):
self.value = value
@@ -451,8 +453,10 @@ def run_tests():
print(" Your rebalance likely created a cycle or otherwise broke the")
print(" tree structure (a child pointing back up at an ancestor).\n")
continue
except Exception as e:
print(f" RESULT: ERROR - {type(e).__name__}: {e}\n")
except Exception:
print(f" RESULT: ERROR - see stack trace below\n")
print(traceback.format_exc())
print("")
continue
# Guard the author (you) against a typo when adding a new case: the