diff --git a/autotest/test_executables.py b/autotest/test_executables.py index c06edc3..7f9f330 100644 --- a/autotest/test_executables.py +++ b/autotest/test_executables.py @@ -26,3 +26,6 @@ def test_access(exes): # .get() works too assert exes.get("not a target") is None assert exes.get("not a target", exes["pytest"]) == exes["pytest"] + # membership test + assert "not a target" not in exes + assert "pytest" in exes diff --git a/modflow_devtools/executables.py b/modflow_devtools/executables.py index 9e34149..59408ae 100644 --- a/modflow_devtools/executables.py +++ b/modflow_devtools/executables.py @@ -16,6 +16,9 @@ class Executables(SimpleNamespace): def __init__(self, **kwargs): super().__init__(**kwargs) + def __contains__(self, item): + return item in self.__dict__ + def __setitem__(self, key, item): self.__dict__[key] = item