Coverage for tests/serializers/params.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.17.3, created at 2026-11-13 05:19 +0000

1from dataclasses import dataclass 1abcdefghijklmnopqr

2from datetime import datetime, timezone 1abcdefghijklmnopqr

3 

4import pytest 1abcdefghijklmnopqr

5 

6 

7@dataclass 1abcdefghijklmnopqr

8class SimpleDataclass: 1abcdefghijklmnopqr

9 r: str 1abcdefghijkl

10 

11 

12now = datetime.now(timezone.utc) 1abcdefghijklmnopqr

13 

14parametrized = ( 1abcdefghijklmnopqr

15 pytest.param( 

16 "hello", 

17 b'"hello"', 

18 id="str", 

19 ), 

20 pytest.param( 

21 b"hello", 

22 b"hello", 

23 id="bytes", 

24 ), 

25 pytest.param( 

26 1.0, 

27 b"1.0", 

28 id="float", 

29 ), 

30 pytest.param( 

31 1, 

32 b"1", 

33 id="int", 

34 ), 

35 pytest.param( 

36 False, 

37 b"false", 

38 id="bool", 

39 ), 

40) 

41 

42comptex_params = [ 1abcdefghijklmnopqr

43 pytest.param( 

44 {"m": 1}, 

45 b'{"m":1}', 

46 id="dict", 

47 ), 

48 pytest.param( 

49 [1, 2, 3], 

50 b"[1,2,3]", 

51 id="list", 

52 ), 

53 pytest.param( 

54 SimpleDataclass(r="hello!"), 

55 b'{"r":"hello!"}', 

56 id="dataclass", 

57 ), 

58]