Skip to content

Commit 28a4d0b

Browse files
committed
new test
1 parent e0b1c99 commit 28a4d0b

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

pydatastructs/miscellaneous_data_structures/tests/test_disjoint_set.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@ def test_DisjointSetForest():
1515

1616
assert (dst.find_root(1) == dst.find_root(2) ==
1717
dst.find_root(5) == dst.find_root(6) == dst.find_root(8))
18-
assert dst.find_root(1).key == 1
19-
assert dst.find_root(2).key == 1
20-
dst.make_root(8)
21-
assert dst.find_root(2).key == 8
22-
assert dst.find_root(8).key == 8
2318
assert dst.find_root(3) == dst.find_root(4)
2419
assert dst.find_root(7).key == 7
25-
dst.make_root(2)
20+
2621
assert raises(KeyError, lambda: dst.find_root(9))
27-
assert raises(KeyError, lambda: dst.make_root(19))
2822
dst.union(3, 1)
29-
assert dst.find_root(3).key == 2
23+
assert dst.find_root(3).key == 1
24+
assert dst.find_root(5).key == 1
25+
dst.make_root(6)
26+
assert dst.find_root(3).key == 6
27+
assert dst.find_root(5).key == 6
28+
dst.make_root(5)
29+
assert dst.find_root(1).key == 5
30+
assert dst.find_root(5).key == 5
31+
assert raises(KeyError, lambda: dst.make_root(9))

0 commit comments

Comments
 (0)