# xarray.testing.strategies.unique_subset_of

### xarray.testing.strategies.unique_subset_of(objs, , min_size=0, max_size=None)

Return a strategy which generates a unique subset of the given objects.

Each entry in the output subset will be unique (if input was a sequence) or have a unique key (if it was a mapping).

Requires the hypothesis package to be installed.

* **Parameters:**
  * **objs** (`Union[Sequence[Hashable]`, `Mapping[Hashable`, `Any]]`) – Objects from which to sample to produce the subset.
  * **min_size** ([`int`](https://docs.python.org/3/builtins/functions.html#int), *optional*) – Minimum size of the returned subset. Default is 0.
  * **max_size** ([`int`](https://docs.python.org/3/builtins/functions.html#int), *optional*) – Maximum size of the returned subset. Default is the full length of the input.
    If set to 0 the result will be an empty mapping.
* **Returns:**
  `unique_subset_strategy` – Strategy generating subset of the input.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('501b9a90-dedc-42a3-9ade-55de3437b675','eba54f3a-e52d-4de6-a69f-14a1e3a80a0c','98838aaa-56c6-4639-bf58-c48b9ac59c7e','../lite/tree/../notebooks/index.html?path=eaa520bc_abe0_470b_8c62_011af578913f.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> unique_subset_of({"x": 2, "y": 3}).example()
{'y': 3}
>>> unique_subset_of(["x", "y"]).example()
['x']
```

<div id="98838aaa-56c6-4639-bf58-c48b9ac59c7e" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('501b9a90-dedc-42a3-9ade-55de3437b675','98838aaa-56c6-4639-bf58-c48b9ac59c7e')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('501b9a90-dedc-42a3-9ade-55de3437b675','98838aaa-56c6-4639-bf58-c48b9ac59c7e')">Open In Tab</button></div><div id="eba54f3a-e52d-4de6-a69f-14a1e3a80a0c" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>

#### SEE ALSO
[Hypothesis testing](../user-guide/testing.html.md#testing-hypothesis)
