Thank you, I pushed it in. Fabian, if you have any objections, we can make another patch.
Vinzent 2010/2/23 Øyvind Jensen <jensen.oyv...@gmail.com>: > An exception could be raised as a false positive. We should only > demand consistency between two resolutors if they have both reached a > conclusion. Before this patch, an exception would be raised in the event of > an > inconclusive resolutor following a conclusive. > > Added a test for the issue > --- > sympy/assumptions/ask.py | 7 ++++++- > sympy/assumptions/tests/test_query.py | 9 +++++++++ > 2 files changed, 15 insertions(+), 1 deletions(-) > > diff --git a/sympy/assumptions/ask.py b/sympy/assumptions/ask.py > index f575d7c..3814278 100644 > --- a/sympy/assumptions/ask.py > +++ b/sympy/assumptions/ask.py > @@ -75,7 +75,12 @@ def ask(expr, key, assumptions=True): > if hasattr(handler, subclass.__name__): > res = getattr(handler, subclass.__name__)(expr, assumptions) > if _res is None: _res = res > - elif _res != res: raise ValueError, 'incompatible resolutors' > + elif res is None: > + # since first resolutor was conclusive, we keep that > value > + res = _res > + else: > + # only check consistency if both resolutors have > concluded > + if _res != res: raise ValueError, 'incompatible > resolutors' > break > if res is not None: > return res > diff --git a/sympy/assumptions/tests/test_query.py > b/sympy/assumptions/tests/test_query.py > index 0078dc6..aa2b1a6 100644 > --- a/sympy/assumptions/tests/test_query.py > +++ b/sympy/assumptions/tests/test_query.py > @@ -926,6 +926,15 @@ def Number(expr, assumptions): > return True > register_handler('prime', Prime2AskHandler) > raises(ValueError, 'ask(4, Q.prime)') > + remove_handler('prime', Prime2AskHandler) > + > + class InconclusiveHandler(AskHandler): > + �...@staticmethod > + def Number(expr, assumptions): > + return None > + register_handler('prime', InconclusiveHandler) > + assert ask(3, Q.prime) == True > + > > def test_key_extensibility(): > """test that you can add keys to the ask system at runtime""" > -- > 1.6.5 > > -- > You received this message because you are subscribed to the Google Groups > "sympy-patches" group. > To post to this group, send email to sympy-patc...@googlegroups.com. > To unsubscribe from this group, send email to > sympy-patches+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sympy-patches?hl=en. > > -- You received this message because you are subscribed to the Google Groups "sympy-patches" group. To post to this group, send email to sympy-patc...@googlegroups.com. To unsubscribe from this group, send email to sympy-patches+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy-patches?hl=en.