Skip to content

🧪 Improve test coverage for utilities.split() edge cases#155

Merged
tjzegmott merged 1 commit into
mainfrom
improve-utilities-split-tests-599810441351711448
May 20, 2026
Merged

🧪 Improve test coverage for utilities.split() edge cases#155
tjzegmott merged 1 commit into
mainfrom
improve-utilities-split-tests-599810441351711448

Conversation

@tjzegmott
Copy link
Copy Markdown
Contributor

🎯 What:
Added a guard in utilities.split() to raise ValueError on zero or negative counts, preventing ZeroDivisionError. Added edge case tests in test_utils.py to cover these scenarios.

📊 Coverage:

  • Test with empty list to ensure empty chunks are returned.
  • Test with count=0 to ensure ValueError is raised.
  • Test with count=-1 to ensure ValueError is raised.

Result:
The test coverage of utilities.split() was improved and now includes verification of critical edge cases that could previously trigger a ZeroDivisionError.


PR created automatically by Jules for task 599810441351711448 started by @tjzegmott

- Added a guard in `utilities.split()` to raise ValueError on zero/negative counts.
- Added edge case tests in `test_utils.py` covering empty list, zero count, and negative count.

Co-authored-by: tjzegmott <20817254+tjzegmott@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings May 19, 2026 18:23
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens dtcli.utilities.utilities.split() against invalid count values by raising a clear ValueError instead of allowing runtime failures, and adds targeted tests to cover edge cases.

Changes:

  • Add an input guard in utilities.split() to raise ValueError when count <= 0.
  • Add tests for empty input and invalid count values (0, -1) to improve coverage of split() edge cases.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
dtcli/utilities/utilities.py Adds validation to prevent invalid count values from reaching the batching math.
tests/test_utils.py Adds pytest-based edge case tests covering empty input and invalid count values.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coveralls
Copy link
Copy Markdown

coveralls commented May 19, 2026

Coverage Status

coverage: 65.594% (+0.2%) from 65.371% — improve-utilities-split-tests-599810441351711448 into main

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.59%. Comparing base (c0921ec) to head (e951364).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #155      +/-   ##
==========================================
+ Coverage   65.37%   65.59%   +0.22%     
==========================================
  Files          15       15              
  Lines        1389     1398       +9     
==========================================
+ Hits          908      917       +9     
  Misses        481      481              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 65.594% (+0.2%) from 65.371% — improve-utilities-split-tests-599810441351711448 into main

@tjzegmott tjzegmott merged commit 7c01e86 into main May 20, 2026
10 checks passed
@tjzegmott tjzegmott deleted the improve-utilities-split-tests-599810441351711448 branch May 20, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants