Skip to content

🧪 Add unit tests for Labels string parsing#45

Merged
rnovatorov merged 4 commits intomainfrom
testing-improvement-labels-parsing-6959259806670736819
Apr 1, 2026
Merged

🧪 Add unit tests for Labels string parsing#45
rnovatorov merged 4 commits intomainfrom
testing-improvement-labels-parsing-6959259806670736819

Conversation

@rnovatorov
Copy link
Copy Markdown
Member

🎯 What: The testing gap for Labels.parse was addressed, and the implementation was hardened against edge cases.
📊 Coverage: The new tests cover:

  • Standard multi-label strings (device=foo telemetry=bar).
  • Single-label strings (device=only).
  • Empty strings (now returns an empty Labels object instead of raising ValueError).
  • Redundant whitespace (now ignores extra spaces between labels).
    Result: Improved reliability of label parsing and increased test coverage for the telemetry module.

PR created automatically by Jules for task 6959259806670736819 started by @rnovatorov

- Added unit tests for `Labels.parse` covering multiple labels, single labels, empty strings, and multiple spaces.
- Fixed `Labels.parse` to gracefully handle empty strings and redundant whitespace.
- Added a `conftest.py` in the new test directory to mock missing dependencies in restricted environments.

Co-authored-by: rnovatorov <20299819+rnovatorov@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.

As requested, removed the `conftest.py` file that was mocking dependencies, as they are expected to be installed in the environment.

Co-authored-by: rnovatorov <20299819+rnovatorov@users.noreply.github.com>
google-labs-jules bot and others added 2 commits April 1, 2026 13:27
Switched to using `s.split()` which more cleanly handles empty strings and multiple spaces compared to the previous explicit checks.

Co-authored-by: rnovatorov <20299819+rnovatorov@users.noreply.github.com>
Reverted the simplification of `Labels.parse` to its original state as requested, and updated the unit tests to match this behavior.

Co-authored-by: rnovatorov <20299819+rnovatorov@users.noreply.github.com>
@rnovatorov rnovatorov marked this pull request as ready for review April 1, 2026 13:53
@rnovatorov rnovatorov merged commit 5a4854d into main Apr 1, 2026
7 checks passed
@rnovatorov rnovatorov deleted the testing-improvement-labels-parsing-6959259806670736819 branch April 1, 2026 14:02
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.

1 participant