Merge "swob.Match: Optional whitespace is optional"
This commit is contained in:
commit
bbf5e5c7f3
@ -623,6 +623,9 @@ class Match(object):
|
||||
def __init__(self, headerval):
|
||||
self.tags = set()
|
||||
for tag in headerval.split(','):
|
||||
tag = tag.strip()
|
||||
if not tag:
|
||||
continue
|
||||
if tag.startswith('"') and tag.endswith('"'):
|
||||
self.tags.add(tag[1:-1])
|
||||
else:
|
||||
|
@ -285,6 +285,20 @@ class TestMatch(unittest.TestCase):
|
||||
self.assertIn('b', match)
|
||||
self.assertNotIn('c', match)
|
||||
|
||||
def test_match_no_optional_white_space(self):
|
||||
match = swift.common.swob.Match('"a","b"')
|
||||
self.assertEqual(match.tags, set(('a', 'b')))
|
||||
self.assertIn('a', match)
|
||||
self.assertIn('b', match)
|
||||
self.assertNotIn('c', match)
|
||||
|
||||
def test_match_lots_of_optional_white_space(self):
|
||||
match = swift.common.swob.Match('"a" , , "b" ')
|
||||
self.assertEqual(match.tags, set(('a', 'b')))
|
||||
self.assertIn('a', match)
|
||||
self.assertIn('b', match)
|
||||
self.assertNotIn('c', match)
|
||||
|
||||
|
||||
class TestTransferEncoding(unittest.TestCase):
|
||||
def test_is_chunked(self):
|
||||
|
Loading…
Reference in New Issue
Block a user