示例#1
0
def test_advanced(request):
    expected = ("{   "
                "\n    'args': dict,"
                "\n    'data': str,"
                "\n    'headers': {   "
                "\n        'Accept': str,"
                "\n        'Accept-Encoding': str,"
                "\n        'Connection': str,"
                "\n        'Host': str,"
                "\n        'User-Agent': str,"
                "\n    },"
                "\n    'json': NoneType,"
                "\n    'method': str,"
                "\n    'url': str,"
                "\n}")
    assert pformat(request) == expected
示例#2
0
def test_advanced():
    expected = ("{   "
                "\n    'args': dict,"
                "\n    'data': str,"
                "\n    'files': dict,"
                "\n    'form': dict,"
                "\n    'headers': {   "
                "\n        'Accept': str,"
                "\n        'Accept-Encoding': str,"
                "\n        'Connection': str,"
                "\n        'Host': str,"
                "\n        'User-Agent': str,"
                "\n    },"
                "\n    'json': NoneType,"
                "\n    'method': str,"
                "\n    'origin': str,"
                "\n    'url': str,"
                "\n}")
    r = requests.get('http://httpbin.org/anything', timeout=2)
    assert pformat(r.json()) == expected
示例#3
0
def test_simple_ints(lst):
    assert pformat(lst) == '[int]'
示例#4
0
def test_dict_mix(dct):
    assert pformat(dct) == "{'a': [int], 'b': str}"
示例#5
0
def test_simple_dict(dct):
    assert pformat(dct) == "{'a': int, 'b': int}"
示例#6
0
def test_simple_mix(lst):
    assert pformat(lst) == '[str, int, int, str]'
示例#7
0
def test_simple_strs(lst):
    assert pformat(lst) == '[str]'
示例#8
0
def test_simple_strs():
    assert pformat(['a', 'b', 'c']) == '[str]'
示例#9
0
def test_simple_ints():
    assert pformat([1, 2, 3]) == '[int]'
示例#10
0
def test_dict_mix():
    assert pformat({'a': [1, 2, 3], 'b': 'c'}) == "{'a': [int], 'b': str}"
示例#11
0
def test_simple_dict():
    assert pformat({'a': 1, 'b': 2}) == "{'a': int, 'b': int}"
示例#12
0
def test_simple_mix():
    assert pformat(['a', 1, 2, 'b']) == '[str, int, int, str]'