GeocodeGlib.MockBackend¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class GeocodeGlib.MockBackend(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
All the fields in the
GeocodeGlib.MockBackend
structure are private and should never be accessed directly.New in version 3.23.1.
- classmethod new()¶
- Returns:
a new
GeocodeGlib.MockBackend
- Return type:
Creates a new mock backend implementation with no initial forward or reverse query results (so it will return an empty result set for all queries).
New in version 3.23.1.
- add_forward_result(params, results, error)¶
- Parameters:
params ({
str
:GObject.Value
}) – query parameters to respond to, in the same format as accepted byGeocodeGlib.Forward.search
()results ([
GeocodeGlib.Place
] orNone
) – result set to return for the query, orNone
if error is non-None
; result sets must be in the same format as returned byGeocodeGlib.Forward.search
()error (
GLib.Error
orNone
) – error to return for the query, orNone
if results should be returned instead; errors must match those returned byGeocodeGlib.Forward.search
()
Add a query and corresponding result (or error) to the mock backend, meaning that if it receives a forward search for params through
GeocodeGlib.Backend.forward_search
() (or its asynchronous variants), the mock backend will return the given results or error to the caller.If a set of params is added to the backend multiple times, the most recently provided results and error will be used.
Exactly one of results and error must be set. Empty result sets are represented as a
GeocodeGlib.Error.NO_MATCHES
error.New in version 3.23.1.
- add_reverse_result(params, results, error)¶
- Parameters:
params ({
str
:GObject.Value
}) – query parameters to respond to, in the same format as accepted byGeocodeGlib.Reverse.resolve
()results ([
GeocodeGlib.Place
] orNone
) – result set to return for the query, orNone
if error is non-None
; result sets must be in the same format as returned byGeocodeGlib.Reverse.resolve
()error (
GLib.Error
orNone
) – error to return for the query, orNone
if results should be returned instead; errors must match those returned byGeocodeGlib.Reverse.resolve
()
Add a query and corresponding result (or error) to the mock backend, meaning that if it receives a reverse search for params through
GeocodeGlib.Backend.reverse_resolve
() (or its asynchronous variants), the mock backend will return the given results or error to the caller.If a set of params is added to the backend multiple times, the most recently provided results and error will be used.
Exactly one of results and error must be set. Empty result sets are represented as a
GeocodeGlib.Error.NOT_SUPPORTED
error.New in version 3.23.1.
- clear()¶
Clear the set of stored results in the mock backend which have been added using
GeocodeGlib.MockBackend.add_forward_result
() andGeocodeGlib.MockBackend.add_reverse_result
(). Additionally, clear the query log so far (seeGeocodeGlib.MockBackend.get_query_log
()).This effectively resets the mock backend to its initial state.
New in version 3.23.1.
- get_query_log()¶
- Returns:
potentially empty sequence of forward and reverse query details
- Return type:
Get the details of the forward and reverse queries which have been requested of the mock backend since the most recent call to
GeocodeGlib.MockBackend.clear
(). The query details are provided asGeocodeGlib.MockBackendQuery
structures, which map the query parameters to either the result set or the error whichGeocodeGlib.Backend.forward_search
() orGeocodeGlib.Backend.reverse_resolve
() (or their asynchronous variants) returned to the caller.The results are provided in the order in which calls were made to
GeocodeGlib.Backend.forward_search
() andGeocodeGlib.Backend.reverse_resolve
(). Results for forward and reverse queries may be interleaved.New in version 3.23.1.