From 88e20104f427b81dc371690e7fb532f46752c527 Mon Sep 17 00:00:00 2001 From: Deepak Cherian Date: Fri, 15 Mar 2024 13:05:36 -0600 Subject: [PATCH] Better duplicate assumption --- xarray/tests/test_state_machine.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xarray/tests/test_state_machine.py b/xarray/tests/test_state_machine.py index 7e38e1b15bb..719fe3106ac 100644 --- a/xarray/tests/test_state_machine.py +++ b/xarray/tests/test_state_machine.py @@ -3,7 +3,7 @@ import hypothesis.extra.numpy as npst import hypothesis.strategies as st import numpy as np -from hypothesis import note, settings +from hypothesis import assume, note, settings from hypothesis.stateful import RuleBasedStateMachine, invariant, precondition, rule import xarray.testing.strategies as xrst @@ -97,7 +97,8 @@ def unstack(self): choices = get_multiindex_dims(self.dataset) if choices: dim = random.choice(choices) - self.dataset = self.dataset.drop_duplicates(dim).unstack(dim) + assume(self.dataset.xindexes[dim].index.is_unique) + self.dataset = self.dataset.unstack(dim) else: self.dataset = self.dataset.unstack()