Skip to content

🧪 [testing improvement] Add Missing Error Handling Test in translate_model.py - #1333

Merged
tushuhei merged 2 commits into
mainfrom
fix/translate-model-test-coverage-5075075278882585906
Aug 17, 2026
Merged

🧪 [testing improvement] Add Missing Error Handling Test in translate_model.py#1333
tushuhei merged 2 commits into
mainfrom
fix/translate-model-test-coverage-5075075278882585906

Conversation

@tushuhei

Copy link
Copy Markdown
Member

🎯 What: The testing gap addressed is the lack of explicit testing for AttributeError handling within the normalize() function in scripts/translate_model.py.
📊 Coverage: The new scenario now tests passing an object without a values() method (such as a list) where a dictionary is expected, confirming that the except (AssertionError, AttributeError) block catches it and raises a ValueError.
Result: Improvement in test coverage, ensuring that changes to normalization structures will correctly fail if malformed input is given, maintaining robustness.


PR created automatically by Jules for task 5075075278882585906 started by @tushuhei

Added a new test `test_broken_input_attribute_error` in `scripts/tests/test_translate_model.py` to cover the `AttributeError` branch inside the `try-except` block in `translate_model.normalize()`.
Updated existing error handling tests to strictly assert `ValueError` instead of the generic `Exception`.

Co-authored-by: tushuhei <734905+tushuhei@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.

Added a new test `test_broken_input_attribute_error` in `scripts/tests/test_translate_model.py` to cover the `AttributeError` branch inside the `try-except` block in `translate_model.normalize()`.
Updated existing error handling tests to strictly assert `ValueError` instead of the generic `Exception`.

Co-authored-by: tushuhei <734905+tushuhei@users.noreply.github.com>
@tushuhei
tushuhei marked this pull request as ready for review August 17, 2026 01:35
@tushuhei
tushuhei requested a review from kojiishi August 17, 2026 01:58

@kojiishi kojiishi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

@tushuhei
tushuhei merged commit 95bad23 into main Aug 17, 2026
31 checks passed
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.

2 participants