Skip to content

Commit e4e4eda

Browse files
committed
add class annotation test
1 parent 16a789a commit e4e4eda

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/test_unit_eval.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,22 @@ class Decorated:
222222
""",
223223
["second", "first"],
224224
],
225+
[
226+
"""
227+
hits = []
228+
229+
def anno():
230+
hits.append("ok")
231+
return int
232+
233+
class Annotated:
234+
a: anno()
235+
b: int = 3
236+
c = "skip"
237+
[hits, Annotated.__annotations__, Annotated.b, hasattr(Annotated, "c")]
238+
""",
239+
[["ok"], {"a": int, "b": int}, 3, True],
240+
],
225241
["Foo = [type('Foo', (), {'x': 100})]; Foo[0].x = 10; Foo[0].x", 10],
226242
["Foo = [type('Foo', (), {'x': [100, 101]})]; Foo[0].x[1] = 10; Foo[0].x", [100, 10]],
227243
["Foo = [type('Foo', (), {'x': [0, [[100, 101]]]})]; Foo[0].x[1][0][1] = 10; Foo[0].x[1]", [[100, 10]]],

0 commit comments

Comments
 (0)