Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 3
0
def test_simple_ints(lst):
    assert pformat(lst) == '[int]'
Ejemplo n.º 4
0
def test_dict_mix(dct):
    assert pformat(dct) == "{'a': [int], 'b': str}"
Ejemplo n.º 5
0
def test_simple_dict(dct):
    assert pformat(dct) == "{'a': int, 'b': int}"
Ejemplo n.º 6
0
def test_simple_mix(lst):
    assert pformat(lst) == '[str, int, int, str]'
Ejemplo n.º 7
0
def test_simple_strs(lst):
    assert pformat(lst) == '[str]'
Ejemplo n.º 8
0
def test_simple_strs():
    assert pformat(['a', 'b', 'c']) == '[str]'
Ejemplo n.º 9
0
def test_simple_ints():
    assert pformat([1, 2, 3]) == '[int]'
Ejemplo n.º 10
0
def test_dict_mix():
    assert pformat({'a': [1, 2, 3], 'b': 'c'}) == "{'a': [int], 'b': str}"
Ejemplo n.º 11
0
def test_simple_dict():
    assert pformat({'a': 1, 'b': 2}) == "{'a': int, 'b': int}"
Ejemplo n.º 12
0
def test_simple_mix():
    assert pformat(['a', 1, 2, 'b']) == '[str, int, int, str]'