# 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('2e58c1be-244e-4b18-9b0b-56746d90799a','0b72686c-0e8d-4cd0-8384-015042c30113','978a7d60-aa97-4f57-8204-410440465146','../lite/tree/../notebooks/index.html?path=0441733e_66d5_4db1_9c7a_e7cf1c2db798.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="978a7d60-aa97-4f57-8204-410440465146" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('2e58c1be-244e-4b18-9b0b-56746d90799a','978a7d60-aa97-4f57-8204-410440465146')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('2e58c1be-244e-4b18-9b0b-56746d90799a','978a7d60-aa97-4f57-8204-410440465146')">Open In Tab</button></div><div id="0b72686c-0e8d-4cd0-8384-015042c30113" 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)
