Skip to content

Commit ec92fe6

Browse files
committed
test llist hashability
1 parent 693cf8a commit ec92fe6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

unpythonic/llist.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,15 @@ def test():
323323
l3 = cons(6, cdr(l1))
324324
assert l3 == ll(6, 2, 1)
325325

326+
# test hashability
327+
s = set()
328+
s.add(cons(1, 2))
329+
s.add(ll(1, 2, 3))
330+
assert cons(1, 2) in s
331+
assert ll(1, 2, 3) in s
332+
assert cons(3, 4) not in s
333+
assert ll(1, 2) not in s
334+
326335
print("All tests PASSED")
327336

328337
if __name__ == '__main__':

0 commit comments

Comments
 (0)