From 561a4adef722f63321606385996516fa74cc1c07 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 14 Mar 2012 21:46:00 -0400 Subject: [PATCH] Fix rich comparison doctest prompts and add comparisons to None. The None comparison logic avoids: TypeError: long() argument must be a string or a number, not 'NoneType' --- pycomedi/constant.pyx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pycomedi/constant.pyx b/pycomedi/constant.pyx index e227f47..1fed075 100644 --- a/pycomedi/constant.pyx +++ b/pycomedi/constant.pyx @@ -88,10 +88,12 @@ False True >>> TRIG_SRC.now != TRIG_SRC.now False -<<< TRIG_SRC.now <= 2 +>>> TRIG_SRC.now <= 2 True -<<< TRIG_SRC.now < 3 +>>> TRIG_SRC.now < 3 False +>>> TRIG_SRC.now > None +True .. [#ops] See `emulating numeric types`_ and `NotImplementedError` in `the standard type hierarchy`_. @@ -171,6 +173,8 @@ cdef class BitwiseOperator (object): return BitwiseOperator(int(long.__or__(s, o))) def __richcmp__(self, other, op): + if other is None: + other = self.value - 1 s,o = BitwiseOperator._prepare_self_other(self, other) if op == 0: return s < o -- 2.26.2