From a686741e67043bb2c5f85dfed7a01df924fbf964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 19 Jul 2016 07:45:18 +0700 Subject: [PATCH] Allow None in Greater/Less PYSON issue5711 review32311002 --- proteus/pyson.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/proteus/pyson.py b/proteus/pyson.py index 112d6df264..9404d0e0e7 100644 --- a/proteus/pyson.py +++ b/proteus/pyson.py @@ -315,10 +315,10 @@ class Greater(PYSON): super(Greater, self).__init__() for i in (statement1, statement2): if isinstance(i, PYSON): - assert i.types().issubset(set([int, long, float])), \ + assert i.types().issubset({int, long, float, type(None)}), \ 'statement must be an integer or a float' else: - assert isinstance(i, (int, long, float)), \ + assert isinstance(i, (int, long, float, type(None))), \ 'statement must be an integer or a float' if isinstance(equal, PYSON): assert equal.types() == set([bool]) @@ -346,6 +346,8 @@ class Greater(PYSON): @staticmethod def _convert(dct): for i in ('s1', 's2'): + if dct[i] is None: + dct[i] = 0.0 if not isinstance(dct[i], (int, long, float)): dct = dct.copy() dct[i] = float(dct[i])