Skip to content

🧪 test: add tests for parse_site_location edge cases#38

Draft
rnovatorov wants to merge 3 commits intomainfrom
test-parse-site-location-5468704340888702486
Draft

🧪 test: add tests for parse_site_location edge cases#38
rnovatorov wants to merge 3 commits intomainfrom
test-parse-site-location-5468704340888702486

Conversation

@rnovatorov
Copy link
Member

🎯 What: The testing gap for parse_site_location in src/enapter/cli/http/api/site_location.py has been addressed. The function parses site location coordinates strings and previously lacked unit test coverage.
📊 Coverage: Test coverage has been added for valid locations, locations with extra spaces around names and values, as well as several exceptions: missing values, extra values, non-numeric latitude/longitude coordinates, and empty string handling.
Result: Test coverage for parse_site_location is fully covered, preventing potential future regressions and making its behavior verifiable and reliable.


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

Added unit tests to `tests/unit/test_cli/test_http/test_api/test_site_location.py` to cover `parse_site_location`. The tests cover standard string format, string containing spaces, exceptions handling incorrect lengths (too few or too many parameters), incorrect coordinate formats (non-float characters), and empty strings.

Co-authored-by: rnovatorov <20299819+rnovatorov@users.noreply.github.com>
@google-labs-jules
Copy link
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.

google-labs-jules bot and others added 2 commits March 17, 2026 17:13
The `test_standalone/test_mqtt_adapter.py` test suite used `await asyncio.sleep(0.02)` to wait for mocked methods to be called before assertions. Under higher load, or in some configurations like Python 3.13, this constant delay was insufficient, causing intermittent failures such as `AssertionError: Expected 'publish_log' to have been called`. This replaces the arbitrary sleeps with deterministic synchronization primitives (`asyncio.Event`) where tests wait explicitly for up to 1 second for the mocked function to be called before checking assertions.

Co-authored-by: rnovatorov <20299819+rnovatorov@users.noreply.github.com>
The `test_standalone/test_mqtt_adapter.py` test suite used `await asyncio.sleep(0.02)` to wait for mocked methods to be called before assertions. Under higher load, or in some configurations like Python 3.13, this constant delay was insufficient, causing intermittent failures such as `AssertionError: Expected 'publish_log' to have been called`. This replaces the arbitrary sleeps with deterministic synchronization primitives (`asyncio.Event`) where tests wait explicitly for up to 1 second for the mocked function to be called before checking assertions.

Also run `black` to format the new code modifications.

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