Skip to content

Commit

Permalink
Tweak test
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Nov 10, 2023
1 parent 519de68 commit a29b1a8
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions crates/ruff_workspace/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1593,10 +1593,7 @@ mod tests {

#[test]
fn select_docstring_convention_override() {
fn _check_docstring_override(
rule_selections: Vec<RuleSelection>,
should_be_overridden: bool,
) {
fn assert_override(rule_selections: Vec<RuleSelection>, should_be_overridden: bool) {
use ruff_linter::rules::pydocstyle::settings::Convention;

let config = LintConfiguration {
Expand Down Expand Up @@ -1631,26 +1628,26 @@ mod tests {
let d41 = RuleSelector::from_str("D41").unwrap();
let d417 = RuleSelector::from_str("D417").unwrap();

// D417 does not appear with prefix
_check_docstring_override(
// D417 does not appear when D41 is provided...
assert_override(
vec![RuleSelection {
select: Some(vec![d41.clone()]),
..RuleSelection::default()
}],
false,
);

// But does appear with rule selector
_check_docstring_override(
// ...but does appear when specified directly.
assert_override(
vec![RuleSelection {
select: Some(vec![d41.clone(), d417.clone()]),
..RuleSelection::default()
}],
true,
);

// But disappears if there's another select
_check_docstring_override(
// ...but disappears if there's a subsequent `--select`.
assert_override(
vec![
RuleSelection {
select: Some(vec![d417.clone()]),
Expand All @@ -1664,8 +1661,8 @@ mod tests {
false,
);

// But an extend-select is ok
_check_docstring_override(
// ...although an `--extend-select` is fine.
assert_override(
vec![
RuleSelection {
select: Some(vec![d417.clone()]),
Expand Down

0 comments on commit a29b1a8

Please sign in to comment.