Skip invalid branch of domain without the inverted field

Those branches of the domain should not prevent to compute a proper inverted
domain for the field as the other fields will be fixed later.

issue9200
review311191002
This commit is contained in:
Cédric Krier committed 2020-04-12 23:21:08 +02:00
1 parent a48382124f
commit 4c664bf1b1
2 files changed
+5 -2

No files matched your search

+3 -2
View File
@@ -367,7 +367,7 @@ class DomainInversionTestCase(unittest.TestCase):
self.assertEqual(
domain_inversion(domain, 'z', {'x': 5}), [['z', '=', 3]])
self.assertEqual(
domain_inversion(domain, 'z', {'x': 5, 'y': 5}), False)
domain_inversion(domain, 'z', {'x': 5, 'y': 5}), [['z', '=', 3]])
self.assertEqual(
domain_inversion(domain, 'z', {'x': 5, 'y': 7}), [['z', '=', 3]])
@@ -376,7 +376,8 @@ class DomainInversionTestCase(unittest.TestCase):
self.assertEqual(domain_inversion(domain, 'z'), [['z', '=', 3]])
self.assertEqual(
domain_inversion(domain, 'z', {'x': 5}), [['z', '=', 3]])
self.assertEqual(domain_inversion(domain, 'z', {'y': 5}), False)
self.assertEqual(
domain_inversion(domain, 'z', {'y': 5}), [['z', '=', 3]])
self.assertEqual(
domain_inversion(domain, 'z', {'x': 4, 'y': 7}), [['z', '=', 3]])
+2
View File
@@ -340,6 +340,8 @@ class And(object):
if isinstance(part, And):
part_inversion = part.inverse(symbol, context)
evaluated = isinstance(part_inversion, bool)
if symbol not in part.variables:
continue
if not evaluated:
result.append(part_inversion)
elif part_inversion: