@@ -17,9 +17,13 @@ class MyEnum(Enum):
17
17
assert v .to_python (MyEnum .a , mode = 'json' ) == 1
18
18
assert v .to_json (MyEnum .a ) == b'1'
19
19
20
- with pytest .warns (UserWarning , match = 'Expected `enum` but got `int` - serialized value may not be as expected' ):
20
+ with pytest .warns (
21
+ UserWarning , match = 'Expected `enum` but got `int` with value `1` - serialized value may not be as expected'
22
+ ):
21
23
assert v .to_python (1 ) == 1
22
- with pytest .warns (UserWarning , match = 'Expected `enum` but got `int` - serialized value may not be as expected' ):
24
+ with pytest .warns (
25
+ UserWarning , match = 'Expected `enum` but got `int` with value `1` - serialized value may not be as expected'
26
+ ):
23
27
assert v .to_json (1 ) == b'1'
24
28
25
29
@@ -35,9 +39,13 @@ class MyEnum(int, Enum):
35
39
assert v .to_python (MyEnum .a , mode = 'json' ) == 1
36
40
assert v .to_json (MyEnum .a ) == b'1'
37
41
38
- with pytest .warns (UserWarning , match = 'Expected `enum` but got `int` - serialized value may not be as expected' ):
42
+ with pytest .warns (
43
+ UserWarning , match = 'Expected `enum` but got `int` with value `1` - serialized value may not be as expected'
44
+ ):
39
45
assert v .to_python (1 ) == 1
40
- with pytest .warns (UserWarning , match = 'Expected `enum` but got `int` - serialized value may not be as expected' ):
46
+ with pytest .warns (
47
+ UserWarning , match = 'Expected `enum` but got `int` with value `1` - serialized value may not be as expected'
48
+ ):
41
49
assert v .to_json (1 ) == b'1'
42
50
43
51
@@ -53,9 +61,13 @@ class MyEnum(str, Enum):
53
61
assert v .to_python (MyEnum .a , mode = 'json' ) == 'a'
54
62
assert v .to_json (MyEnum .a ) == b'"a"'
55
63
56
- with pytest .warns (UserWarning , match = 'Expected `enum` but got `str` - serialized value may not be as expected' ):
64
+ with pytest .warns (
65
+ UserWarning , match = "Expected `enum` but got `str` with value `'a'` - serialized value may not be as expected"
66
+ ):
57
67
assert v .to_python ('a' ) == 'a'
58
- with pytest .warns (UserWarning , match = 'Expected `enum` but got `str` - serialized value may not be as expected' ):
68
+ with pytest .warns (
69
+ UserWarning , match = "Expected `enum` but got `str` with value `'a'` - serialized value may not be as expected"
70
+ ):
59
71
assert v .to_json ('a' ) == b'"a"'
60
72
61
73
@@ -76,9 +88,13 @@ class MyEnum(Enum):
76
88
assert v .to_python ({MyEnum .a : 'x' }, mode = 'json' ) == {'1' : 'x' }
77
89
assert v .to_json ({MyEnum .a : 'x' }) == b'{"1":"x"}'
78
90
79
- with pytest .warns (UserWarning , match = 'Expected `enum` but got `str` - serialized value may not be as expected' ):
91
+ with pytest .warns (
92
+ UserWarning , match = "Expected `enum` but got `str` with value `'x'` - serialized value may not be as expected"
93
+ ):
80
94
assert v .to_python ({'x' : 'x' }) == {'x' : 'x' }
81
- with pytest .warns (UserWarning , match = 'Expected `enum` but got `str` - serialized value may not be as expected' ):
95
+ with pytest .warns (
96
+ UserWarning , match = "Expected `enum` but got `str` with value `'x'` - serialized value may not be as expected"
97
+ ):
82
98
assert v .to_json ({'x' : 'x' }) == b'{"x":"x"}'
83
99
84
100
@@ -99,7 +115,11 @@ class MyEnum(int, Enum):
99
115
assert v .to_python ({MyEnum .a : 'x' }, mode = 'json' ) == {'1' : 'x' }
100
116
assert v .to_json ({MyEnum .a : 'x' }) == b'{"1":"x"}'
101
117
102
- with pytest .warns (UserWarning , match = 'Expected `enum` but got `str` - serialized value may not be as expected' ):
118
+ with pytest .warns (
119
+ UserWarning , match = "Expected `enum` but got `str` with value `'x'` - serialized value may not be as expected"
120
+ ):
103
121
assert v .to_python ({'x' : 'x' }) == {'x' : 'x' }
104
- with pytest .warns (UserWarning , match = 'Expected `enum` but got `str` - serialized value may not be as expected' ):
122
+ with pytest .warns (
123
+ UserWarning , match = "Expected `enum` but got `str` with value `'x'` - serialized value may not be as expected"
124
+ ):
105
125
assert v .to_json ({'x' : 'x' }) == b'{"x":"x"}'
0 commit comments