-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid crash on custom rules without doc string (#96)
* Avoid crash on custom rules without doc string * Add custom rule doc string to docs * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Handle edge case first Co-authored-by: Aleksey <allburov@gmail.com> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Aleksey <allburov@gmail.com>
- Loading branch information
1 parent
d336d13
commit 808e211
Showing
3 changed files
with
27 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from artifactory_cleanup.rules import Rule | ||
|
||
|
||
class CustomRuleWithDocs(Rule): | ||
"""Example with doc string""" | ||
|
||
|
||
class CustomRuleWithoutDocs(Rule): | ||
pass | ||
|
||
|
||
def test_custom_rule_with_docstring_adds_to_title(): | ||
rule = CustomRuleWithDocs() | ||
assert rule.title() == "Example with doc string" | ||
|
||
|
||
def test_custom_rule_without_docstring(): | ||
rule = CustomRuleWithoutDocs() | ||
assert rule.title() == "" |