From 3c08341b0b2390d90c80c31a3673cd859bbd5ad4 Mon Sep 17 00:00:00 2001 From: JenR8ed <1014672+JenR8ed@users.noreply.github.com> Date: Wed, 8 Apr 2026 19:42:53 +0000 Subject: [PATCH] Add edge case test for empty JSON array in validate_report This commit adds `test_validate_empty_list` to `test_validate_report.py`. This test verifies that the `validate()` function correctly handles an empty JSON array, ensuring the core assertion `isinstance(data, list)` does not fail on empty inputs. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- test_validate_report.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test_validate_report.py b/test_validate_report.py index 3ee29d8..79ba4ef 100644 --- a/test_validate_report.py +++ b/test_validate_report.py @@ -10,6 +10,13 @@ def test_validate_success(): # Should not raise any exception validate() +def test_validate_empty_list(): + """Test validate() with an empty JSON array.""" + mock_data = json.dumps([]) + with patch("builtins.open", mock_open(read_data=mock_data)): + # Should not raise any exception + validate() + def test_validate_not_a_list(): """Test validate() when root is not a JSON array.""" mock_data = json.dumps({"id": 1, "status": "pass"})