intercom_test.http_best_matches module¶
Module for finding nearest imperfect match for HTTP request
-
class
intercom_test.http_best_matches.
AvailableAdditionalFieldsReport
(available_value_sets)[source]¶
-
class
intercom_test.http_best_matches.
Database
(cases: Iterable[dict], *, add_request_keys=())[source]¶ Bases:
object
-
class
intercom_test.http_best_matches.
JsonComparer
(ref)[source]¶ Bases:
object
Utility to compare one JSON document with several others
-
CONGRUENT_DATA
= 'congruent options'¶
-
class
Delta
[source]¶ Bases:
tuple
Differences between two JSON documents
This difference always consists of three parts, in decreasing order of precedence:
- Changes to which substructures are present,
- Changes to where substructures are located, and
- Changes to scalar values.
Only one of these three will be non-empty.
Use
distance()
to get a sortable distance measure for this delta.-
scalar_diffs
¶
-
structure_diffs
¶
-
structure_location_diffs
¶
-
diff
(case) → intercom_test.http_best_matches.JsonComparer.Delta[source]¶ Diffs two JSON documents
The difference evaluation proceeds in three steps, with each of the later steps proceeding only if the earlier step produced no differences.
The steps are:
- All substructures (lists and dicts, with correct subitem signatures) are present.
- All substructures are in the correct locations.
- Each scalar value location holds the expected scalar value.
To reflect this, the differences are returned as a tuple of three
Sequence`s wrapped in a :class:
.JsonComparer.Delta`, only one of which will contain any items:- Changes to which substructures are present.
- Changes to where substructures are located.
- Changes to scalar values.
-
-
class
intercom_test.http_best_matches.
JsonMap
(json_data)[source]¶ Bases:
object
-
scalars
¶ Indexes correspond with
scalar_key_paths()
-
substruct_key_paths
¶ Indexes correspond with
substruct_signatures()
-
substruct_locations
¶
-
substruct_signatures
¶ Indexes correspond with
substruct_key_paths()
-
-
class
intercom_test.http_best_matches.
JsonType
¶ Bases:
enum.IntEnum
An enumeration.
-
NoneType
= 1¶
-
construct
()¶
-
dict
= 6¶
-
float
= 4¶
-
int
= 3¶
-
is_collection
¶
-
list
= 5¶
-
str
= 2¶
-
-
class
intercom_test.http_best_matches.
QStringComparer
(qsparams: Sequence[Tuple[str, str]])[source]¶ Bases:
object
Utility to compare one URL query string with several others
-
intercom_test.http_best_matches.
lookup_json_type
()¶ Return the value for key if key is in the dictionary, else default.