2017-10-27 12:15:19 +00:00
|
|
|
from pydu.set import OrderedSet
|
2017-10-20 13:27:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_ordered_set():
|
|
|
|
ordered_set = OrderedSet([1, 3, 1, 2])
|
|
|
|
assert list(ordered_set) == [1, 3, 2]
|
|
|
|
assert 1 in ordered_set
|
|
|
|
assert bool(ordered_set)
|
|
|
|
|
2017-12-24 15:45:04 +00:00
|
|
|
ordered_set.add(1)
|
|
|
|
assert 1 in ordered_set
|
|
|
|
|
|
|
|
ordered_set.remove(1)
|
|
|
|
assert 1 not in ordered_set
|
|
|
|
|
2017-10-20 13:27:54 +00:00
|
|
|
for i in range(4):
|
|
|
|
ordered_set.discard(i)
|
2017-12-24 15:51:26 +00:00
|
|
|
assert not bool(ordered_set)
|