Skip to content

Commit fcd3e0a

Browse files
committed
add regression test for python#16454
1 parent 8980c84 commit fcd3e0a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test-data/unit/check-dataclasses.test

+15
Original file line numberDiff line numberDiff line change
@@ -2544,3 +2544,18 @@ class Base:
25442544
class Child(Base):
25452545
y: int
25462546
[builtins fixtures/dataclasses.pyi]
2547+
2548+
[case testDataclassDisallowAny]
2549+
# flags: --disallow-any-explicit --disallow-any-decorated
2550+
2551+
from dataclasses import dataclass
2552+
from typing import Any
2553+
2554+
# Ensures that when Any-typed fields end up in synthetic functions,
2555+
# those functions are not flagged since there's nothing the user can do about that
2556+
@dataclass
2557+
class C:
2558+
a: Any # E: Explicit "Any" is not allowed
2559+
2560+
[typing fixtures/typing-full.pyi]
2561+
[builtins fixtures/dataclasses.pyi]

0 commit comments

Comments
 (0)