From 94ffa2001fc6357e2edfe837d04dbc8cea17ab84 Mon Sep 17 00:00:00 2001 From: Steven Tobin Date: Wed, 26 Nov 2025 19:57:10 +0000 Subject: [PATCH] harden CSV correctness tests --- tests/test_csv.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/test_csv.py b/tests/test_csv.py index b220946..b5bf219 100644 --- a/tests/test_csv.py +++ b/tests/test_csv.py @@ -5,6 +5,7 @@ """ from pathlib import Path from typing import List +from csv import reader as csv_reader def count_columns(file_name: Path) -> None: @@ -15,14 +16,14 @@ def count_columns(file_name: Path) -> None: expected_column_count: int = 0 with open(file_name, mode="r", encoding="utf-8") as my_file: - for line in my_file: - + my_csv = csv_reader(my_file) + for line in my_csv: # All lines must match the header of the file: if first_line: first_line = False - expected_column_count = len(line.split(",")) + expected_column_count = len(line) - assert expected_column_count == len(line.split(",")) + assert expected_column_count == len(line) def test_column_count() -> None: """