26 lines
597 B
Python
26 lines
597 B
Python
import meili
|
|
|
|
|
|
def test_parse():
|
|
s = 'payment_date >= 2025-07-01 AND status = PAID'
|
|
r = meili.parse(s)
|
|
|
|
assert r == [
|
|
{'attr': 'payment_date', 'op': '>=', 'value': '2025-07-01'},
|
|
{'attr': 'status', 'op': '=', 'value': 'PAID'},
|
|
]
|
|
|
|
assert meili.parse('cnpj%20EXISTS') == [
|
|
{'attr': 'cnpj', 'op': 'EXISTS', 'value': ''}
|
|
]
|
|
|
|
|
|
def test_encode():
|
|
r = meili.encode(
|
|
[
|
|
{'attr': 'tenant', 'op': '=', 'value': '*'},
|
|
{'attr': 'cnpj', 'op': 'EXISTS', 'value': ''},
|
|
]
|
|
)
|
|
assert r == 'tenant = * AND cnpj EXISTS'
|