summaryrefslogtreecommitdiff
path: root/gbp
diff options
context:
space:
mode:
Diffstat (limited to 'gbp')
-rw-r--r--gbp/tristate.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/gbp/tristate.py b/gbp/tristate.py
index 9361060..0a800ec 100644
--- a/gbp/tristate.py
+++ b/gbp/tristate.py
@@ -66,6 +66,17 @@ class Tristate(object):
else:
return 'off'
+ def __nonzero__(self):
+ """
+ >>> Tristate('on').__nonzero__()
+ True
+ >>> Tristate('auto').__nonzero__()
+ True
+ >>> Tristate('off').__nonzero__()
+ False
+ """
+ return self._state is not self.OFF
+
@property
def state(self):
"""Get current state"""