Skip to content

test(geocoding): hard regression tests for enable_address_descriptor (fixes #540)#543

Open
Rahulcse79 wants to merge 1 commit intogooglemaps:masterfrom
Rahulcse79:fix/reverse-geocode-address-descriptor
Open

test(geocoding): hard regression tests for enable_address_descriptor (fixes #540)#543
Rahulcse79 wants to merge 1 commit intogooglemaps:masterfrom
Rahulcse79:fix/reverse-geocode-address-descriptor

Conversation

@Rahulcse79
Copy link
Copy Markdown

Summary

Fixes #540reverse_geocode() got an unexpected keyword argument 'enable_address_descriptor'.

The enable_address_descriptor keyword argument was added to googlemaps/geocoding.py in #516 but is not present in the published 4.10.0 release on PyPI, so end users calling:

gmaps.reverse_geocode((center_lat, center_lon), enable_address_descriptor=True)

still hit a TypeError. This PR locks the public surface down with a hard, regression-proof test suite so the kwarg can never silently disappear from a future release again.

What changed

  • New file: tests/test_geocoding_advanced.py — 17 tests + 9 sub-tests, all passing.

The new tests cover:

  • inspect.signature guards on both geocoding.reverse_geocode and Client.reverse_geocode (signature-level regression for Release failed - unexpected keyword argument: enable_address_descriptor still not supported #540).
  • Exact reproduction of the failing call from the bug report — asserts no TypeError is raised.
  • enable_address_descriptor=True → sends enable_address_descriptor=true on the wire.
  • Default / False / falsy values (None, 0, "", [], {}) omit the parameter.
  • Truthy non-bool values (1, "yes", ["x"], {"a":1}) send "true".
  • Combined with result_type, location_type, language.
  • Works with all latlng input forms: tuple, list, dict, "lat,lng" string, and place_id string.
  • address_descriptor (landmarks + areas) is parsed correctly from the response.
  • Repeated calls don't leak the parameter across requests.
  • Module-level call (geocoding.reverse_geocode(client, ...)) also works.
  • Negative test: an unknown / typo'd kwarg still raises TypeError.

Test results

tests/test_geocoding.py ................. [ 17 passed ]
tests/test_geocoding_advanced.py ......... [ 17 passed, 9 sub-tests ]
Full suite: 122 passed

Note for maintainers

A new release (e.g. 4.10.1) cut from master would close #540 for end users on PyPI. These tests guarantee any future refactor of reverse_geocode keeps the documented kwarg.

@Rahulcse79 Rahulcse79 closed this Apr 29, 2026
@Rahulcse79 Rahulcse79 reopened this Apr 29, 2026
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.

Release failed - unexpected keyword argument: enable_address_descriptor still not supported

1 participant