Add test_escapes_escaped_colon
@@ -98,8 +98,29 @@ class TestCompoundPredicate(unittest.TestCase):
predicate_1,
predicate_2
])(record)
+ assert len(set(block_val)) == 4
assert block_val == ['foo\\::\\:bar', 'foo\\::bar', 'foo:\\:bar', 'foo:bar']
+ def test_escapes_escaped_colon(self):
+ '''
+ Regression test for issue #836
+ '''
+ predicate_1 = predicates.SimplePredicate(
+ predicates.commonSetElementPredicate, 'col_1')
+ predicate_2 = predicates.SimplePredicate(
+ predicates.commonSetElementPredicate, 'col_2')
+ record = {
+ 'col_1': ['foo\\:', 'foo'],
+ 'col_2': ['\\:bar', 'bar']
+ }
+
+ block_val = predicates.CompoundPredicate([
+ predicate_1,
+ predicate_2
+ ])(record)
+ assert len(set(block_val)) == 4
+ assert block_val == ['foo\\\\::\\\\:bar', 'foo\\\\::bar', 'foo:\\\\:bar', 'foo:bar']
+
if __name__ == '__main__':
unittest.main()
