From 3b88f5d6c7c9e14ff7941d5be8252f78e427bfa6 Mon Sep 17 00:00:00 2001 From: Cal Paterson Date: Thu, 8 Aug 2024 13:36:26 +0300 Subject: [PATCH] Small mypy fixes --- csvbase/web/schemaorg.py | 4 +++- tests/test_seo.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/csvbase/web/schemaorg.py b/csvbase/web/schemaorg.py index 8cfab45..52e8d5e 100644 --- a/csvbase/web/schemaorg.py +++ b/csvbase/web/schemaorg.py @@ -28,8 +28,10 @@ def to_dataset(table: Table) -> Mapping[str, Any]: if table.has_caption(): obj["description"] = table.caption # if we knew the table wasn't big we could refer to XLSX here: + distribution = [] for content_type in [ContentType.CSV, ContentType.PARQUET, ContentType.JSON_LINES]: - obj["distribution"].append(to_datadownload(table, content_type)) + distribution.append(to_datadownload(table, content_type)) + obj["distribution"] = distribution return obj diff --git a/tests/test_seo.py b/tests/test_seo.py index 351f969..9e6b5ba 100644 --- a/tests/test_seo.py +++ b/tests/test_seo.py @@ -61,8 +61,8 @@ def test_schemaorg_dataset(ten_rows): actual = schemaorg.to_dataset(ten_rows) # do the dates this way - assert datetime.fromisoformat(actual.pop("dateCreated")) == ten_rows.created - assert datetime.fromisoformat(actual.pop("dateModified")) == ten_rows.last_changed + assert datetime.fromisoformat(actual.pop("dateCreated")) == ten_rows.created # type: ignore + assert datetime.fromisoformat(actual.pop("dateModified")) == ten_rows.last_changed # type: ignore # the rest must match: assert expected == actual