From 7a7d619e64314a18c2b27c221df3e71b2df5a200 Mon Sep 17 00:00:00 2001 From: ducklet Date: Sat, 4 Feb 2023 13:18:46 +0100 Subject: [PATCH] IMDb import: fix assertion We should only assert where we know the result, here the input file could just as well be empty. --- unwind/imdb_import.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/unwind/imdb_import.py b/unwind/imdb_import.py index bccb18a..705db2f 100644 --- a/unwind/imdb_import.py +++ b/unwind/imdb_import.py @@ -198,7 +198,9 @@ async def import_from_file(*, basics_path: Path, ratings_path: Path): log.info("💾 Importing movies ...") total = count_lines(basics_path) - assert total != 0 + log.debug("Found %i movies.", total) + if total == 0: + raise RuntimeError(f"No movies found.") perc_next_report = 0.0 perc_step = 0.1