summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/functional/d/dataclass_with_default_factory.py15
-rw-r--r--tests/functional/d/dataclass_with_default_factory.rc2
2 files changed, 17 insertions, 0 deletions
diff --git a/tests/functional/d/dataclass_with_default_factory.py b/tests/functional/d/dataclass_with_default_factory.py
new file mode 100644
index 000000000..b01f38977
--- /dev/null
+++ b/tests/functional/d/dataclass_with_default_factory.py
@@ -0,0 +1,15 @@
+"""A test script the confuses pylint."""
+# https://github.com/PyCQA/pylint/issues/2605
+from dataclasses import dataclass, field
+
+
+@dataclass
+class Test:
+ """A test dataclass with a field, that has a default_factory."""
+
+ test: list = field(default_factory=list)
+
+
+TEST = Test()
+TEST.test.append(1)
+print(TEST.test[0])
diff --git a/tests/functional/d/dataclass_with_default_factory.rc b/tests/functional/d/dataclass_with_default_factory.rc
new file mode 100644
index 000000000..a17bb22da
--- /dev/null
+++ b/tests/functional/d/dataclass_with_default_factory.rc
@@ -0,0 +1,2 @@
+[testoptions]
+min_pyver=3.7