Skip to content

Commit be8ef2b

Browse files
committed
remove auto formatting
1 parent 1b30fbc commit be8ef2b

File tree

1 file changed

+11
-50
lines changed

1 file changed

+11
-50
lines changed

tests/validators/test_dict.py

Lines changed: 11 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,12 @@
1313

1414

1515
def test_dict(py_and_json: PyAndJson):
16-
v = py_and_json(
17-
{
18-
'type': 'dict',
19-
'keys_schema': {'type': 'int'},
20-
'values_schema': {'type': 'int'},
21-
}
22-
)
16+
v = py_and_json({'type': 'dict', 'keys_schema': {'type': 'int'}, 'values_schema': {'type': 'int'}})
2317
assert v.validate_test({'1': 2, '3': 4}) == {1: 2, 3: 4}
24-
v = py_and_json(
25-
{
26-
'type': 'dict',
27-
'strict': True,
28-
'keys_schema': {'type': 'int'},
29-
'values_schema': {'type': 'int'},
30-
}
31-
)
18+
v = py_and_json({'type': 'dict', 'strict': True, 'keys_schema': {'type': 'int'}, 'values_schema': {'type': 'int'}})
3219
assert v.validate_test({'1': 2, '3': 4}) == {1: 2, 3: 4}
3320
assert v.validate_test({}) == {}
34-
with pytest.raises(
35-
ValidationError,
36-
match=re.escape('[type=dict_type, input_value=[], input_type=list]'),
37-
):
21+
with pytest.raises(ValidationError, match=re.escape('[type=dict_type, input_value=[], input_type=list]')):
3822
v.validate_test([])
3923

4024

@@ -44,22 +28,13 @@ def test_dict(py_and_json: PyAndJson):
4428
({'1': b'1', '2': b'2'}, {'1': '1', '2': '2'}),
4529
(OrderedDict(a=b'1', b='2'), {'a': '1', 'b': '2'}),
4630
({}, {}),
47-
(
48-
'foobar',
49-
Err("Input should be a valid dictionary [type=dict_type, input_value='foobar', input_type=str]"),
50-
),
31+
('foobar', Err("Input should be a valid dictionary [type=dict_type, input_value='foobar', input_type=str]")),
5132
([], Err('Input should be a valid dictionary [type=dict_type,')),
5233
([('x', 'y')], Err('Input should be a valid dictionary [type=dict_type,')),
53-
(
54-
[('x', 'y'), ('z', 'z')],
55-
Err('Input should be a valid dictionary [type=dict_type,'),
56-
),
34+
([('x', 'y'), ('z', 'z')], Err('Input should be a valid dictionary [type=dict_type,')),
5735
((), Err('Input should be a valid dictionary [type=dict_type,')),
5836
((('x', 'y'),), Err('Input should be a valid dictionary [type=dict_type,')),
59-
(
60-
(type('Foobar', (), {'x': 1})()),
61-
Err('Input should be a valid dictionary [type=dict_type,'),
62-
),
37+
((type('Foobar', (), {'x': 1})()), Err('Input should be a valid dictionary [type=dict_type,')),
6338
],
6439
ids=repr,
6540
)
@@ -125,11 +100,7 @@ def test_dict_error_key_other():
125100
def test_dict_any_value():
126101
v = SchemaValidator(cs.dict_schema(keys_schema=cs.str_schema()))
127102
v = SchemaValidator(cs.dict_schema(keys_schema=cs.str_schema()))
128-
assert v.validate_python({'1': 1, '2': 'a', '3': None}) == {
129-
'1': 1,
130-
'2': 'a',
131-
'3': None,
132-
}
103+
assert v.validate_python({'1': 1, '2': 'a', '3': None}) == {'1': 1, '2': 'a', '3': None}
133104

134105

135106
def test_mapping():
@@ -273,27 +244,17 @@ def test_dict_complex_key():
273244

274245
v = SchemaValidator(cs.dict_schema(keys_schema=cs.complex_schema(), values_schema=cs.str_schema()))
275246
with pytest.raises(
276-
ValidationError,
277-
match='Input should be a valid python complex object, a number, or a valid complex string',
247+
ValidationError, match='Input should be a valid python complex object, a number, or a valid complex string'
278248
):
279249
v.validate_python({'1+2ja': b'1'})
280250

281251

282252
def test_json_dict_complex_key():
283253
v = SchemaValidator(cs.dict_schema(keys_schema=cs.complex_schema(), values_schema=cs.int_schema()))
284-
assert v.validate_json('{"1+2j": 2, "-3": 4}') == {
285-
complex(1, 2): 2,
286-
complex(-3, 0): 4,
287-
}
288-
assert v.validate_json('{"1+2j": 2, "infj": 4}') == {
289-
complex(1, 2): 2,
290-
complex(0, float('inf')): 4,
291-
}
254+
assert v.validate_json('{"1+2j": 2, "-3": 4}') == {complex(1, 2): 2, complex(-3, 0): 4}
255+
assert v.validate_json('{"1+2j": 2, "infj": 4}') == {complex(1, 2): 2, complex(0, float('inf')): 4}
292256
with pytest.raises(ValidationError, match='Input should be a valid complex string'):
293-
v.validate_json('{"1+2j": 2, "": 4}') == {
294-
complex(1, 2): 2,
295-
complex(0, float('inf')): 4,
296-
}
257+
v.validate_json('{"1+2j": 2, "": 4}') == {complex(1, 2): 2, complex(0, float('inf')): 4}
297258

298259

299260
def test_ordered_dict_key_order_preservation():

0 commit comments

Comments
 (0)