Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion intbot/core/analysis/products.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,15 @@ def flat_product_data(products: list[Product]) -> pl.DataFrame:
)
)

return pl.DataFrame(rows)
schema = pl.Schema({
"product_id": pl.Int64(),
"variation_id": pl.Int64(),
"product_name": pl.String(),
"type": pl.String(),
"variant": pl.String(),
"price": pl.Decimal(precision=10, scale=2),
})
return pl.DataFrame(rows, schema=schema)


def latest_flat_product_data() -> pl.DataFrame:
Expand Down
13 changes: 11 additions & 2 deletions intbot/tests/test_analysis/test_products.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_flat_product_data():
"product_name": pl.String,
"type": pl.String,
"variant": pl.String,
"price": pl.Decimal(precision=None, scale=0),
"price": pl.Decimal(precision=10, scale=2),
}
)

Expand Down Expand Up @@ -185,6 +185,14 @@ def test_latest_flat_product_data():
},
],
)
expected_schema = {
"product_id": pl.Int64,
"variation_id": pl.Int64,
"product_name": pl.String,
"type": pl.String,
"variant": pl.String,
"price": pl.Decimal(precision=10, scale=2),
}
expected = pl.DataFrame(
[
FlatProductDescription(
Expand Down Expand Up @@ -267,7 +275,8 @@ def test_latest_flat_product_data():
type="Late",
price=Decimal("675.00"),
),
]
],
schema=expected_schema,
)

df = latest_flat_product_data()
Expand Down
6 changes: 3 additions & 3 deletions intbot/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
process_zammad_webhook,
)
from django.utils import timezone
from django_tasks.task import ResultStatus
from django_tasks import TaskResultStatus
from httpx import Response


Expand Down Expand Up @@ -56,8 +56,8 @@ def test_process_webhook_fails_if_unsupported_source():
# Instead we have to check the result
result = process_webhook.enqueue(str(wh.uuid))

assert result.status == ResultStatus.FAILED
assert result.traceback.endswith("ValueError: Unsupported source asdf\n")
assert result.status == TaskResultStatus.FAILED
assert any("Unsupported source asdf" in str(e) for e in result.errors)


@pytest.mark.django_db
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ readme = "README.md"
requires-python = ">=3.12,<3.13"
dependencies = [
"discord-py>=2.4.0",
"django>=5.1.4",
"django>=6.0",
"django-tasks>=0.6.1",
"psycopg>=3.2.3",
"ruff>=0.8.6",
Expand All @@ -32,6 +32,9 @@ dependencies = [
"plotly-stubs>=0.0.5",
]

[tool.uv]
exclude-newer = "1 week"

[tool.pytest.ini_options]
pythonpath = [
"intbot"
Expand Down
Loading