Example #1
0
def test_can_percent_encode_reserved_chars():
    encoded = percent_encode("20% of $100 = $20")
    assert encoded == "20%25%20of%20%24100%20%3D%20%2420"
Example #2
0
def test_can_percent_encode_list():
    encoded = percent_encode(["knife&fork", "spoon"])
    assert encoded == "knife%26fork&spoon"
Example #3
0
def test_can_percent_encode_dictionary():
    encoded = percent_encode(OrderedDict([("one", 1), ("two", 2)]))
    assert encoded == "one=1&two=2"
Example #4
0
def test_can_percent_encode_number():
    encoded = percent_encode(12)
    assert encoded == "12"
Example #5
0
def test_can_percent_encode_string():
    encoded = percent_encode("foo")
    assert encoded == "foo"
Example #6
0
def test_can_percent_encode_empty_string():
    encoded = percent_encode("")
    assert encoded == ""
Example #7
0
def test_can_percent_encode_empty_string():
    encoded = percent_encode("")
    assert encoded == ""
Example #8
0
def test_can_percent_encode_extended_chars():
    encoded = percent_encode("/El Niño/")
    assert encoded == "%2FEl%20Ni%C3%B1o%2F"
Example #9
0
def test_can_percent_encode_with_safe_chars():
    encoded = percent_encode("/El Niño/", safe="/|\\")
    assert encoded == "/El%20Ni%C3%B1o/"
Example #10
0
def test_can_percent_encode_dictionary():
    encoded = percent_encode(OrderedDict([("one", 1), ("two", 2)]))
    assert encoded == "one=1&two=2"
Example #11
0
def test_can_percent_encode_reserved_chars():
    encoded = percent_encode("20% of $100 = $20")
    assert encoded == "20%25%20of%20%24100%20%3D%20%2420"
Example #12
0
def test_can_percent_encode_list():
    encoded = percent_encode(["knife&fork", "spoon"])
    assert encoded == "knife%26fork&spoon"
Example #13
0
def test_can_percent_encode_string():
    encoded = percent_encode("foo")
    assert encoded == "foo"
Example #14
0
def test_can_percent_encode_number():
    encoded = percent_encode(12)
    assert encoded == "12"
Example #15
0
def test_can_percent_encode_extended_chars():
    encoded = percent_encode("/El Niño/")
    assert encoded == "%2FEl%20Ni%C3%B1o%2F"
Example #16
0
def test_can_percent_encode_none():
    encoded = percent_encode(None)
    assert encoded is None
Example #17
0
def test_can_percent_encode_with_safe_chars():
    encoded = percent_encode("/El Niño/", safe="/|\\")
    assert encoded == "/El%20Ni%C3%B1o/"
Example #18
0
def test_can_percent_encode_none():
    encoded = percent_encode(None)
    assert encoded is None