Don't suggest array facet if column is only [], closes #610

This commit is contained in:
Simon Willison 2019-11-01 14:45:59 -07:00
commit 7152e76eda
2 changed files with 32 additions and 11 deletions

View file

@ -215,6 +215,20 @@ async def test_array_facet_suggest(app_client):
] == suggestions
@pytest.mark.asyncio
@pytest.mark.skipif(not detect_json1(), reason="Requires the SQLite json1 module")
async def test_array_facet_suggest_not_if_all_empty_arrays(app_client):
facet = ArrayFacet(
app_client.ds,
MockRequest("http://localhost/"),
database="fixtures",
sql="select * from facetable where tags = '[]'",
table="facetable",
)
suggestions = await facet.suggest()
assert [] == suggestions
@pytest.mark.asyncio
@pytest.mark.skipif(not detect_json1(), reason="Requires the SQLite json1 module")
async def test_array_facet_results(app_client):