@@ -17,9 +17,13 @@ class MyEnum(Enum):
1717 assert v .to_python (MyEnum .a , mode = 'json' ) == 1
1818 assert v .to_json (MyEnum .a ) == b'1'
1919
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+ ):
2123 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+ ):
2327 assert v .to_json (1 ) == b'1'
2428
2529
@@ -35,9 +39,13 @@ class MyEnum(int, Enum):
3539 assert v .to_python (MyEnum .a , mode = 'json' ) == 1
3640 assert v .to_json (MyEnum .a ) == b'1'
3741
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+ ):
3945 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+ ):
4149 assert v .to_json (1 ) == b'1'
4250
4351
@@ -53,9 +61,13 @@ class MyEnum(str, Enum):
5361 assert v .to_python (MyEnum .a , mode = 'json' ) == 'a'
5462 assert v .to_json (MyEnum .a ) == b'"a"'
5563
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+ ):
5767 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+ ):
5971 assert v .to_json ('a' ) == b'"a"'
6072
6173
@@ -76,9 +88,13 @@ class MyEnum(Enum):
7688 assert v .to_python ({MyEnum .a : 'x' }, mode = 'json' ) == {'1' : 'x' }
7789 assert v .to_json ({MyEnum .a : 'x' }) == b'{"1":"x"}'
7890
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+ ):
8094 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+ ):
8298 assert v .to_json ({'x' : 'x' }) == b'{"x":"x"}'
8399
84100
@@ -99,7 +115,11 @@ class MyEnum(int, Enum):
99115 assert v .to_python ({MyEnum .a : 'x' }, mode = 'json' ) == {'1' : 'x' }
100116 assert v .to_json ({MyEnum .a : 'x' }) == b'{"1":"x"}'
101117
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+ ):
103121 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+ ):
105125 assert v .to_json ({'x' : 'x' }) == b'{"x":"x"}'
0 commit comments