tfds.testing.FeatureExpectationItem

Test item of a FeatureExpectation.

Should be passed to assertFeature method of FeatureExpectationsTestCase.

Each FeatureExpectationItem test an example serialization/deserialization ( feature.encode_example -> example_serializer.serialize_example -> example_parse.parse_example -> feature.decode_example).

value Input to features.encode_example
expected Expected output after features.decode_example
expected_np Expected output after features.decode_example_np
expected_serialized Optional
decoders Optional tfds.decode.Decoder objects (to overwrite the default features.decode_example). See https://www.tensorflow.org/datasets/decode.
dtype If decoders is provided, the output of decode_example is checked against this value (otherwise, output is checked against features.dtype)
shape If decoders is provided, the output of decode_example is checked against this value (otherwise, output is checked against features.shape)
raise_cls Expected error raised during features.encode_example. When set expected and expected_serialized should be None.
raise_cls_np Expected error raised during features.encode_example_np. When set expected_np and expected_serialized_np should be None.
raise_msg Expected error message regex.
atol If provided, compare float values with this precision (use default otherwise).

Methods

__eq__

atol None
decoders None
dtype None
expected None
expected_np None
expected_serialized None
raise_cls None
raise_cls_np None
raise_msg None
shape None