-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf8281c
commit 32116ae
Showing
3 changed files
with
32 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Don't report ``no-value-for-parameter`` for dataclasses fields annotated with ``KW_ONLY``. | ||
|
||
Closes #5767 |
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,27 @@ | ||
"""Tests for dataclass and checks that check for parameters.""" | ||
|
||
import dataclasses | ||
from dataclasses import KW_ONLY as keyword_only | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class MyDataClass: | ||
"""Simple dataclass with a KW_ONLY parameter.""" | ||
|
||
_: dataclasses.KW_ONLY | ||
data: str | ||
|
||
|
||
MyDataClass(data="test") | ||
|
||
|
||
@dataclass | ||
class MyDataClassWithAliases: | ||
"""Simple dataclass with an aliased KW_ONLY parameter.""" | ||
|
||
_: keyword_only | ||
data: str | ||
|
||
|
||
MyDataClassWithAliases(data="test") |
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,2 @@ | ||
[testoptions] | ||
min_pyver=3.10 |