mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
New colname__in=x,y,z filter, closes #433
This commit is contained in:
parent
c4645c0f2b
commit
78e9972b46
3 changed files with 62 additions and 2 deletions
|
|
@ -53,6 +53,28 @@ import pytest
|
|||
['"bar" > :p0', '"baz" is null', '"foo" is null'],
|
||||
[10]
|
||||
),
|
||||
(
|
||||
{
|
||||
'foo__in': '1,2,3',
|
||||
},
|
||||
['foo in (:p0, :p1, :p2)'],
|
||||
["1", "2", "3"]
|
||||
),
|
||||
# JSON array variants of __in (useful for unexpected characters)
|
||||
(
|
||||
{
|
||||
'foo__in': '[1,2,3]',
|
||||
},
|
||||
['foo in (:p0, :p1, :p2)'],
|
||||
[1, 2, 3]
|
||||
),
|
||||
(
|
||||
{
|
||||
'foo__in': '["dog,cat", "cat[dog]"]',
|
||||
},
|
||||
['foo in (:p0, :p1)'],
|
||||
["dog,cat", "cat[dog]"]
|
||||
),
|
||||
])
|
||||
def test_build_where(args, expected_where, expected_params):
|
||||
f = Filters(sorted(args.items()))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue