From 5f96255b643262b0c9001f916e30e8c9be093c5c Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Fri, 20 Jan 2023 16:16:47 +0000 Subject: [PATCH] Add an assert and an assert message. --- csv_diff/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/csv_diff/__init__.py b/csv_diff/__init__.py index 650966d..23506a9 100644 --- a/csv_diff/__init__.py +++ b/csv_diff/__init__.py @@ -28,9 +28,10 @@ def load_csv(fp, key=None, dialect=None): def load_json(fp, key=None): raw_list = json.load(fp) - assert isinstance(raw_list, list) + assert isinstance(raw_list, list), "JSON must be a list of dicts." common_keys = set() for item in raw_list: + assert isinstance(item, dict), "JSON must be a list of dicts." common_keys.update(item.keys()) if key: keyfn = lambda r: r[key]