<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/datasets/blob/v4.9.10/tensorflow_datasets/testing/feature_test_case.py#L44-L91) |

Test item of a FeatureExpectation.

    tfds.testing.FeatureExpectationItem(
        value: Any,
        expected: Optional[Any] = None,
        expected_np: Optional[np.ndarray] = None,
        expected_serialized: Optional[Any] = None,
        decoders: Optional[utils.TreeDict[Any]] = None,
        dtype: Optional[tf.dtypes.DType] = None,
        shape: Optional[utils.Shape] = None,
        raise_cls: Optional[Type[Exception]] = None,
        raise_cls_np: Optional[Type[Exception]] = None,
        raise_msg: Optional[str] = None,
        atol: Optional[float] = None
    )

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`).

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `value` | Input to `features.encode_example` |
| `expected` | Expected output after `features.decode_example` |
| `expected_np` | Expected output after `features.decode_example_np`. If you want to expect `None`, use [`tfds.testing.TestValue.NONE`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/TestValue#NONE), as None values are not picked up by the tests. |
| `expected_serialized` | Optional |
| `decoders` | Optional [`tfds.decode.Decoder`](https://www.tensorflow.org/datasets/api_docs/python/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). |

<br />

## Methods

### `__eq__`

    __eq__(
        other
    )

Return self==value.

<br />

<br />

<br />

| ## Class Variables ||
|---|---|
| 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` |

<br />