Skip to content

Commit

Permalink
Add tests for pylint-dev#5767
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielNoord committed Aug 21, 2022
1 parent e142ba8 commit 4fd7fb8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/5767.false_positive
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
27 changes: 27 additions & 0 deletions tests/functional/d/dataclass_parameter.py
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")

0 comments on commit 4fd7fb8

Please sign in to comment.