GeocodeGlib.MockBackend

g GObject.GInterface GObject.GInterface GeocodeGlib.Backend GeocodeGlib.Backend GObject.GInterface->GeocodeGlib.Backend GObject.Object GObject.Object GeocodeGlib.MockBackend GeocodeGlib.MockBackend GObject.Object->GeocodeGlib.MockBackend GeocodeGlib.Backend->GeocodeGlib.MockBackend

Subclasses:

None

Methods

Inherited:

GObject.Object (37), GeocodeGlib.Backend (6)

Structs:

GObject.ObjectClass (5)

class

new ()

add_forward_result (params, results, error)

add_reverse_result (params, results, error)

clear ()

get_query_log ()

Virtual Methods

Inherited:

GObject.Object (7), GeocodeGlib.Backend (6)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class GeocodeGlib.MockBackend(**kwargs)
Bases:

GObject.Object, GeocodeGlib.Backend

Abstract:

No

Structure:

GeocodeGlib.MockBackendClass

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:

GeocodeGlib.MockBackend

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:

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:

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() and GeocodeGlib.MockBackend.add_reverse_result(). Additionally, clear the query log so far (see GeocodeGlib.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:

[GeocodeGlib.MockBackendQuery]

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 as GeocodeGlib.MockBackendQuery structures, which map the query parameters to either the result set or the error which GeocodeGlib.Backend.forward_search() or GeocodeGlib.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() and GeocodeGlib.Backend.reverse_resolve(). Results for forward and reverse queries may be interleaved.

New in version 3.23.1.