Skip to content

Commit

Permalink
Use call
Browse files Browse the repository at this point in the history
  • Loading branch information
harupy committed Nov 21, 2024
1 parent 1ddef63 commit fda25ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def test_csv_with_parens(param1, param2):
...


parametrize = pytest.mark.parametrize(("param1,param2"), [(1, 2), (3, 4)])
parametrize = pytest.mark.parametrize(argnames=("param1,param2"), argvalues=[(1, 2), (3, 4)])

@parametrize
def test_csv_with_parens_decorator(param1, param2):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -800,21 +800,20 @@ pub(crate) fn parametrize(checker: &mut Checker, call: &ExprCall) {
return;
}

let ExprCall { arguments, .. } = call;
if checker.enabled(Rule::PytestParametrizeNamesWrongType) {
if let Some(names) = arguments.find_argument("argnames", 0) {
if let Some(names) = call.arguments.find_argument("argnames", 0) {
check_names(checker, call, names);
}
}
if checker.enabled(Rule::PytestParametrizeValuesWrongType) {
if let Some(names) = arguments.find_argument("argnames", 0) {
if let Some(values) = arguments.find_argument("argvalues", 1) {
if let Some(names) = call.arguments.find_argument("argnames", 0) {
if let Some(values) = call.arguments.find_argument("argvalues", 1) {
check_values(checker, names, values);
}
}
}
if checker.enabled(Rule::PytestDuplicateParametrizeTestCases) {
if let Some(values) = arguments.find_argument("argvalues", 1) {
if let Some(values) = call.arguments.find_argument("argvalues", 1) {
check_duplicates(checker, values);
}
}
Expand Down

0 comments on commit fda25ed

Please sign in to comment.