# 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.

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

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('540288c8-5262-4898-a6a5-c81bc8c8b48c','76e7fc58-9103-4bad-936a-9aa7c1652cd4','dc634149-7cb5-4db4-8871-2f1609bed482','../lite/tree/../notebooks/index.html?path=75b53a48_98ce_45b3_953d_ce414745c24a.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="dc634149-7cb5-4db4-8871-2f1609bed482" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('540288c8-5262-4898-a6a5-c81bc8c8b48c','dc634149-7cb5-4db4-8871-2f1609bed482')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('540288c8-5262-4898-a6a5-c81bc8c8b48c','dc634149-7cb5-4db4-8871-2f1609bed482')">Open In Tab</button></div><div id="76e7fc58-9103-4bad-936a-9aa7c1652cd4" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
