bt2: field.py: refactor field comparison
Changed:
* In _NumericField._extract_value(), do not check the `False`, and
`True` special cases: check that the parameter is an instance of the
`bool` type to return a boolean object.
* In _ArrayField.__eq__(), be more strict: expect that the parameter is
a sequence object, not just an iterable object. Before this, it was
possible to compare an array field to an ordered dict with keys equal
to the array field content, and this seems wrong as:
collections.OrderedDict((('A', 23), ('B', 42))) == ['A', 'B']
is false. An ordered dict is not a sequence.
* In _StructureField.__eq__(), be more strict: expect that the parameter
is a mapping object, not just an iterable and indexable object. The
reason is similar to the _ArrayField.__eq__() case above. This should
be enough to compare to another structure field or to a dict (or
ordered dict).
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I17f33c24e9dea526e59b5058235d57facb51cfbf
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1564
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
This page took 0.026613 seconds and 4 git commands to generate.