Buckets:

download
raw
1.25 kB
import pytest
from syncmaster.db.repositories.search import build_tsquery
@pytest.mark.parametrize(
["user_input", "expected"],
[
pytest.param(
"some word 12345",
"('some' & 'word' & '12345') | ('some':* & 'word':* & '12345':*)",
id="alphanumeric",
),
pytest.param(
"with_underscore_123",
"('with_underscore_123') | ('with_underscore_123':*) | ('with':* & 'underscore':* & '123':*)",
id="with_underscore",
),
pytest.param(
"some-domain.name",
"('some-domain.name') | ('some-domain.name':*) | ('some':* & 'domain':* & 'name':*)",
id="domain_name",
),
pytest.param(
"/file/path",
"('/file/path') | ('/file/path':*) | ('file':* & 'path':*)",
id="file_path",
),
pytest.param(
"!@#$%^&*()_+~-=[]{}|;':,./<>?a_lot_of_punctuation",
"('a_lot_of_punctuation') | ('a_lot_of_punctuation':*) | ('a':* & 'lot':* & 'of':* & 'punctuation':*)",
id="strip_punctuation",
),
],
)
def test_build_tsquery(user_input: str, expected: str) -> None:
assert build_tsquery(user_input) == expected

Xet Storage Details

Size:
1.25 kB
·
Xet hash:
e800222c24428b5550d03937c702ca1b60beca5b63094c956b4b1b48eac29f25

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.