示例#1
0
def test_urlencode_object():
    class Trivial(object):
        def __str__(self):
            return "trivial"

        def __unicode__(self):
            return u"trivial"

        def __bytes__(self):
            return b"trivial"

    u = URI()
    u.query = {u"a": Trivial()}
    assert u.query_string == b"a=trivial"
示例#2
0
def test_urlencode_object():
	class Trivial(object):
		def __str__(self):
			return 'trivial'

		def __unicode__(self):
			return u'trivial'

		def __bytes__(self):
			return b'trivial'

	u = URI()
	u.query = {u'a': Trivial()}
	assert u.query_string == b'a=trivial'
示例#3
0
def test_urlencode_object():
    class Trivial(object):
        def __str__(self):
            return 'trivial'

        def __unicode__(self):
            return u'trivial'

        def __bytes__(self):
            return b'trivial'

    u = URI()
    u.query = {u'a': Trivial()}
    assert u.query_string == b'a=trivial'
示例#4
0
def test_urlencode_sequences():
    u = URI()
    u.query = {"a": [1, 2], "b": (3, 4, 5)}
    assert set(u.query_string.split(b"&")) == {b"a=1", b"a=2", b"b=3", b"b=4", b"b=5"}
示例#5
0
def test_query_string_compose(query_string, query):
    uri = URI(b"http://example.com/")
    uri.query = query
    assert uri.query_string == query_string
示例#6
0
def test_urlencode_sequences():
	u = URI()
	u.query = {'a': [1, 2], 'b': (3, 4, 5)}
	assert set(u.query_string.split(b'&')) == {b'a=1', b'a=2', b'b=3', b'b=4', b'b=5'}
示例#7
0
def test_urlencode_sequences():
    u = URI()
    u.query = {'a': [1, 2], 'b': (3, 4, 5)}
    assert set(u.query_string.split(b'&')) == {
        b'a=1', b'a=2', b'b=3', b'b=4', b'b=5'
    }
示例#8
0
def test_query_string_compose(query_string, query):
    uri = URI(b'http://example.com/')
    uri.query = query
    assert uri.query_string == query_string