Skip to content

Commit

Permalink
Add test_escapes_escaped_colon
Browse files Browse the repository at this point in the history
  • Loading branch information
fjsj committed Jul 20, 2020
1 parent 2506efb commit 9862fef
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/test_predicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,29 @@ def test_escapes_colon(self):
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()

0 comments on commit 9862fef

Please sign in to comment.