Skip to content

Commit

Permalink
Add a test to ensure short blocklist words are ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtmckee committed Aug 3, 2024
1 parent ec13701 commit 442f316
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test_blocklist.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,12 @@ def test_max_encoding_attempts():

with pytest.raises(Exception):
sqids.encode([0])


def test_small_words_are_ignored():
"""Blocklist words shorter than 3 characters must be ignored."""

id_ = Sqids().encode([0])
assert id_ == "bM"
id_ = Sqids(blocklist=[id_]).encode([0])
assert id_ == "bM"

0 comments on commit 442f316

Please sign in to comment.