diff --git a/tests/test_annotations.py b/tests/test_annotations.py index 2f61c136a..203b8ddee 100644 --- a/tests/test_annotations.py +++ b/tests/test_annotations.py @@ -12,6 +12,7 @@ import attr +from attr._make import _is_class_var from attr.exceptions import UnannotatedAttributeError @@ -604,3 +605,19 @@ class C: with pytest.raises(NameError): typing.get_type_hints(C.__init__) + + +@pytest.mark.parametrize( + "annot", + [ + typing.ClassVar, + "typing.ClassVar", + "'typing.ClassVar[dict]'", + "t.ClassVar[int]", + ], +) +def test_is_class_var(annot): + """ + ClassVars are detected, even if they're a string or quoted. + """ + assert _is_class_var(annot)