]> khamidou — GitHub mirrors - imapclient.git/commitdiff
More (passing) tests for square bracket handling
authorMenno Smits <menno@freshfoo.com>
Fri, 10 Sep 2010 12:40:30 +0000 (13:40 +0100)
committerMenno Smits <menno@freshfoo.com>
Fri, 10 Sep 2010 12:40:30 +0000 (13:40 +0100)
imapclient/test/test_response_parser.py

index 2ddd45b68f92c3d0228f4c538da9850e7a095339..68d8078a52cc3203c28f15d6fc76baf0e3b7bcb0 100644 (file)
@@ -136,6 +136,12 @@ class TestParseResponse(unittest.TestCase):
         self._test(r'"foo \"bar\""', 'foo "bar"')
         self._test(r'"foo\\bar"', r'foo\bar')
 
+    def test_square_brackets(self):
+        self._test('foo[bar rrr]', 'foo[bar rrr]')
+        self._test('"foo[bar rrr]"', 'foo[bar rrr]')
+        self._test('[foo bar]', '[foo bar]')  # Square brackets at start
+        self._test('(foo [bar rrr])', ('foo', '[bar rrr]'))
+        self._test('(foo foo[bar rrr])', ('foo', 'foo[bar rrr]'))
 
     def test_incomplete_tuple(self):
         self._test_parse_error('abc (1 2', 'Tuple incomplete before "(1 2"')