@@ -326,26 +326,26 @@ cdef class ExprCons:
326326 def __richcmp__ (self , other , op ):
327327 ''' turn it into a constraint'''
328328 if op == 1 : # <=
329- if not self ._rhs is None :
330- raise TypeError (' ExprCons already has upper bound' )
331- assert not self ._lhs is None
329+ if not self ._rhs is None :
330+ raise TypeError (' ExprCons already has upper bound' )
331+ assert not self ._lhs is None
332332
333- if not _is_number(other):
334- raise TypeError (' Ranged ExprCons is not well defined!' )
333+ if not _is_number(other):
334+ raise TypeError (' Ranged ExprCons is not well defined!' )
335335
336- return ExprCons(self .expr, lhs = self ._lhs, rhs = float (other))
336+ return ExprCons(self .expr, lhs = self ._lhs, rhs = float (other))
337337 elif op == 5 : # >=
338- if not self ._lhs is None :
339- raise TypeError (' ExprCons already has lower bound' )
340- assert self ._lhs is None
341- assert not self ._rhs is None
338+ if not self ._lhs is None :
339+ raise TypeError (' ExprCons already has lower bound' )
340+ assert self ._lhs is None
341+ assert not self ._rhs is None
342342
343- if not _is_number(other):
344- raise TypeError (' Ranged ExprCons is not well defined!' )
343+ if not _is_number(other):
344+ raise TypeError (' Ranged ExprCons is not well defined!' )
345345
346- return ExprCons(self .expr, lhs = float (other), rhs = self ._rhs)
346+ return ExprCons(self .expr, lhs = float (other), rhs = self ._rhs)
347347 else :
348- raise TypeError
348+ raise NotImplementedError ( " Ranged ExprCons can only support with '<=' or '>='. " )
349349
350350 def __repr__ (self ):
351351 return ' ExprCons(%s , %s , %s )' % (self .expr, self ._lhs, self ._rhs)
0 commit comments