Coverage for tests/test_urlencode.py: 100%

1 import httpx

2

3

4 def test_urlencode():

5 qs = "a=name%40example.com&a=456&b=7+8+9&c"

6 d = httpx.urldecode(qs)

7 assert d == {

8 "a": ["name@example.com", "456"],

9 "b": ["7 8 9"],

10 "c": [""]

11 }

12

13

14 def test_urldecode():

15 d = {

16 "a": ["name@example.com", "456"],

17 "b": ["7 8 9"],

18 "c": [""]

19 }

20 qs = httpx.urlencode(d)

21 assert qs == "a=name%40example.com&a=456&b=7+8+9&c="

22

23

24 def test_urlencode_empty():

25 qs = ""

26 d = httpx.urldecode(qs)

27 assert d == {}

28

29

30 def test_urldecode_empty():

31 d = {}

32 qs = httpx.urlencode(d)

33 assert qs == ""