Skip to content
3 changes: 2 additions & 1 deletion tests/test_keys_iter.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def test_modify_with_active_iterators(sorted_dict, iterators, advance):
sorted_dict_len = len(sorted_dict)
sorted_dict_keys = sorted_dict.keys()
sorted_dict_keys_iters = [iter(sorted_dict_keys) for _ in range(iterators)]
advances = [random.randint(0, min(advance, sorted_dict_len)) for _ in sorted_dict_keys_iters]
rg = random.Random(f"{__name__}-{sorted_dict_len}-{iterators}-{advance}")
advances = [rg.randint(0, min(advance, sorted_dict_len)) for _ in sorted_dict_keys_iters]

# Advance the iterators by the arbitrary amounts determined above. Record
# the keys the iterators point to as locked keys.
Expand Down
19 changes: 19 additions & 0 deletions tests/test_uncommon_errors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import re

import pytest

from pysorteddict import SortedDict


def test_key_repr_error():
sorted_dict = SortedDict()
sorted_dict[2**15000] = 0
with pytest.raises(ValueError, match=re.escape("Exceeds the limit")):
str(sorted_dict)


def test_value_repr_error():
sorted_dict = SortedDict()
sorted_dict[0] = 2**15000
with pytest.raises(ValueError, match=re.escape("Exceeds the limit")):
str(sorted_dict)