Example #1
0
 def testComplex(self):
     urlQuery = ('item1={0}&item2[key1.1][][subkey1.1][]={1}&item2[key1.1][][]={1}'
         '&item2[key2.1]={2}&item2[key3.1][subkey3.1]={3}&item3[key1.1][subkey1.1]={4}&noValue'
         ).format(encode('''!D"e#m$o%'''),
                  encode('''&D'e(m)o*'''),
                  encode('''+D e,m-o.'''),
                  encode('''/D[e]m>o<'''),
                  encode('Demo'))
     parseDict = parseStr(urlQuery)
     matchDict = {
         'item1': '!D"e#m$o%',
         'item2': {
             'key1.1': [{'subkey1.1': ["&D'e(m)o*"]}, "&D'e(m)o*"],
             'key2.1': '+D e,m-o.',
             'key3.1': {'subkey3.1': '/D[e]m>o<'}
         },
         'item3': {
             'key1.1': {'subkey1.1': 'Demo'}
         },
         'noValue': None
     }
     self.assertDictEqual(parseDict, matchDict, 'Complex: {0}'.format(urlQuery))
Example #2
0
 def parseURLEncoded(content, charSet): return parseStr(codecs.getreader(charSet)(content).read())
 
 b = ParseTextHandler(); yield b
Example #3
0
 def parseURLEncoded(content, charSet):
     return parseStr(codecs.getreader(charSet)(content).read())
Example #4
0
 def testDictList(self):
     urlQuery = 'list[demo][]=abc&list[demo][]=def&list[demo][]=xyz'
     parseDict = parseStr(urlQuery)
     self.assertDictEqual(parseDict, {'list': {'demo': ['abc', 'def', 'xyz']}}, 'Dict and list: {0}'.format(urlQuery))
Example #5
0
 def testSimpleList(self):
     urlQuery = 'list[]=demo&list[]=demo&list[]=abc' + quote('de mo+de mo')
     parseDict = parseStr(urlQuery)
     self.assertDictEqual(parseDict, {'list': ['demo', 'demo', 'abcde mo+de mo']}, 'Simple list: {0}'.format(urlQuery))
Example #6
0
 def testSimpleMore(self):
     urlQuery = 'simple=demo&another=' + quote('de mo') + '&last=is'
     self.assertDictEqual(parseStr(urlQuery), {'simple': 'demo', 'another': 'de mo', 'last': 'is'}, 'Simple more params: {0}'.format(urlQuery))
Example #7
0
 def testSimple(self):
     urlQuery = 'simple=demo'
     self.assertDictEqual(parseStr(urlQuery), {'simple': 'demo'}, 'Simple: {0}'.format(urlQuery))
Example #8
0
 def parserUrlencoded(content, charSet):
     return parseStr(codecs.getreader(charSet)(content).read())
Example #9
0
 def parseURLEncoded(content, charSet): return parseStr(codecs.getreader(charSet)(content).read())
 
 b = ParseTextHandler(); yield b