Skip to content

Commit d0cc049

Browse files
committed
Dependencies and group by JSON field test 📡
1 parent 1f74d64 commit d0cc049

File tree

5 files changed

+427
-357
lines changed

5 files changed

+427
-357
lines changed

‎.coveragerc‎

Lines changed: 0 additions & 2 deletions
This file was deleted.

‎.github/workflows/tests.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
poetry run pytest . -v
3030
- name: Coverage with pytest
3131
run: |
32-
poetry run pytest . --cov --cov-report xml
32+
poetry run pytest . --cov --cov-report xml --cov-config=pyproject.toml
3333
- uses: codecov/codecov-action@v1
3434
with:
3535
token: ${{ secrets.CODECOV_TOKEN }}

‎duckql/structures/tests/test_query.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,3 +276,22 @@ def test_having():
276276

277277
assert clone == my_query
278278
assert str(clone) == sql
279+
280+
281+
def test_group_by_json():
282+
my_query = Query(
283+
entity='signatories',
284+
properties=[
285+
Property(name='signatories.additional_data->organisation->>name'),
286+
Count(property=Property(name='signatories.additional_data->organisation->>name'))
287+
],
288+
group=[
289+
Property(name='signatories.additional_data->organisation->>name')
290+
]
291+
)
292+
293+
sql = "SELECT signatories.additional_data -> 'organisation' ->> 'name', COUNT(signatories.additional_data -> " \
294+
"'organisation' ->> 'name') FROM signatories GROUP BY signatories.additional_data -> 'organisation' ->> " \
295+
"'name';"
296+
297+
assert str(my_query == sql)

0 commit comments

Comments
 (0)