Skip to content

Commit dca43bf

Browse files
committed
fmt
1 parent dd32329 commit dca43bf

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/build_tools.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,11 @@ impl ExtraBehavior {
198198
}
199199

200200
impl ToPyObject for ExtraBehavior {
201-
fn to_object(&self, py: Python) -> PyObject {
201+
fn to_object(&self, _py: Python) -> PyObject {
202202
match self {
203-
ExtraBehavior::Allow => ExtraBehavior::Allow.to_object(py),
204-
ExtraBehavior::Ignore => ExtraBehavior::Ignore.to_object(py),
205-
ExtraBehavior::Forbid => ExtraBehavior::Forbid.to_object(py),
203+
ExtraBehavior::Allow => ExtraBehavior::Allow.to_object(_py),
204+
ExtraBehavior::Ignore => ExtraBehavior::Ignore.to_object(_py),
205+
ExtraBehavior::Forbid => ExtraBehavior::Forbid.to_object(_py),
206206
}
207207
}
208208
}

src/validators/arguments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl BuildValidator for ArgumentsValidator {
7474
}
7575
None => Some(LookupKey::from_string(py, &name)),
7676
};
77-
kwarg_key = Some(PyString::intern(py, &name).into());
77+
kwarg_key = Some(PyString::new(py, &name).into());
7878
}
7979

8080
let schema: &PyAny = arg.get_as_req(intern!(py, "schema"))?;

tests/validators/test_arguments.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,7 @@ def wrapper(*args, **kwargs):
823823

824824
return decorator
825825

826+
826827
def test_function_any():
827828
@validate()
828829
def foobar(a, b, c):
@@ -914,13 +915,14 @@ def foobar(a: int, b: int, /, c: int):
914915
},
915916
{'type': 'unexpected_keyword_argument', 'loc': ('b',), 'msg': 'Unexpected keyword argument', 'input': 2},
916917
]
917-
# Allowin extras using the config
918+
# Allowing extras using the config
918919
foobar = m.create_function(validate, config={'title': 'func', 'extra_fields_behavior': 'allow'})
919920
assert foobar('1', '2', c=3, d=4) == (1, 2, 3)
920921
# Ignore works similar than allow
921922
foobar = m.create_function(validate, config={'title': 'func', 'extra_fields_behavior': 'ignore'})
922923
assert foobar('1', '2', c=3, d=4) == (1, 2, 3)
923924

925+
924926
@pytest.mark.skipif(sys.version_info < (3, 10), reason='requires python3.10 or higher')
925927
def test_function_positional_only_default(import_execute):
926928
# language=Python

0 commit comments

Comments
 (0)