# Path: restkit/util.py
#     def popen3(cmd, mode='t', bufsize=0):
# def locate_program(program):
# def http_date(timestamp=None):
# def parse_netloc(uri):
# def to_bytestring(s):
# def url_quote(s, charset='utf-8', safe='/:'):
# def url_encode(obj, charset="utf8", encode_keys=False):
# def encode(v, charset="utf8"):
# def make_uri(base, *args, **kwargs):
# def rewrite_location(host_uri, location, prefix_path=None):
# def replace_header(name, value, headers):
# def replace_headers(new_headers, headers):
# def parse_cookie(cookie, final_url):
#     def __init__(self, decorator, attr, message, warning=True):
#     def __get__(self, obj, type=None):
#     def __set__(self, obj, value):
#     def __delete__(self, obj):
#     def __repr__(self):
#     def warn(self):
# class deprecated_property(object):


import t
from restkit import util
# This file is part of restkit released under the MIT license. 
# See the NOTICE for more information.



def test_001():
    qs = {'a': "a"}
    t.eq(util.url_encode(qs), "a=a")
    qs = {'a': 'a', 'b': 'b'}
    t.eq(util.url_encode(qs), "a=a&b=b")
    qs = {'a': 1}
    t.eq(util.url_encode(qs), "a=1")
    qs = {'a': [1, 2]}
    t.eq(util.url_encode(qs), "a=1&a=2")
    qs = {'a': [1, 2], 'b': [3, 4]}
    t.eq(util.url_encode(qs), "a=1&a=2&b=3&b=4")
    qs = {'a': lambda : 1}
    t.eq(util.url_encode(qs), "a=1")
    
def test_002():
    t.eq(util.make_uri("http://localhost", "/"), "http://localhost/")
    t.eq(util.make_uri("http://localhost/"), "http://localhost/")
    t.eq(util.make_uri("http://localhost/", "/test/echo"), 
        "http://localhost/test/echo")
    t.eq(util.make_uri("http://localhost/", "/test/echo/"), 
        "http://localhost/test/echo/")
    t.eq(util.make_uri("http://localhost", "/test/echo/"),
        "http://localhost/test/echo/")
    t.eq(util.make_uri("http://localhost", "test/echo"), 
        "http://localhost/test/echo")

# Path: restkit/util.py
#     def popen3(cmd, mode='t', bufsize=0):
# def locate_program(program):
# def http_date(timestamp=None):
# def parse_netloc(uri):
# def to_bytestring(s):
# def url_quote(s, charset='utf-8', safe='/:'):
# def url_encode(obj, charset="utf8", encode_keys=False):
# def encode(v, charset="utf8"):
# def make_uri(base, *args, **kwargs):
# def rewrite_location(host_uri, location, prefix_path=None):
# def replace_header(name, value, headers):
# def replace_headers(new_headers, headers):
# def parse_cookie(cookie, final_url):
#     def __init__(self, decorator, attr, message, warning=True):
#     def __get__(self, obj, type=None):
#     def __set__(self, obj, value):
#     def __delete__(self, obj):
#     def __repr__(self):
#     def warn(self):
# class deprecated_property(object):


# Path: tests/007-test-util.py
import t
from restkit import util

# This file is part of restkit released under the MIT license. 
# See the NOTICE for more information.



def test_001():
    qs = {'a': "a"}
    t.eq(util.url_encode(qs), "a=a")
    qs = {'a': 'a', 'b': 'b'}
    t.eq(util.url_encode(qs), "a=a&b=b")
    qs = {'a': 1}
    t.eq(util.url_encode(qs), "a=1")
    qs = {'a': [1, 2]}
    t.eq(util.url_encode(qs), "a=1&a=2")
    qs = {'a': [1, 2], 'b': [3, 4]}
    t.eq(util.url_encode(qs), "a=1&a=2&b=3&b=4")
    qs = {'a': lambda : 1}
    t.eq(util.url_encode(qs), "a=1")
    
def test_002():
    t.eq(util.make_uri("http://localhost", "/"), "http://localhost/")
    t.eq(util.make_uri("http://localhost/"), "http://localhost/")
    t.eq(util.make_uri("http://localhost/", "/test/echo"), 
        "http://localhost/test/echo")
    t.eq(util.make_uri("http://localhost/", "/test/echo/"), 
        "http://localhost/test/echo/")
    t.eq(util.make_uri("http://localhost", "/test/echo/"),
        "http://localhost/test/echo/")
    t.eq(util.make_uri("http://localhost", "test/echo"), 
        "http://localhost/test/echo")

    t.eq(util.make_uri("http://localhost", "test/echo/"),