@@ -3,99 +3,99 @@ class SomeClass:
33
44def simple_read_write ():
55 x = SomeClass () # $tracked=foo
6- x .foo = tracked # $tracked $ tracked=foo
7- y = x .foo # $tracked=foo $ tracked
6+ x .foo = tracked # $tracked tracked=foo
7+ y = x .foo # $tracked=foo tracked
88 do_stuff (y ) # $tracked
99
1010def foo ():
1111 x = SomeClass () # $tracked=attr
1212 bar (x ) # $tracked=attr
13- x .attr = tracked # $tracked=attr $ tracked
13+ x .attr = tracked # $tracked=attr tracked
1414 baz (x ) # $tracked=attr
1515
1616def bar (x ): # $tracked=attr
17- z = x .attr # $tracked $ tracked=attr
17+ z = x .attr # $tracked tracked=attr
1818 do_stuff (z ) # $tracked
1919
20- def expects_int (x ): # $int=field $f+: str=field
21- do_int_stuff (x .field ) # $int $f+:str $ int=field $f+: str=field
20+ def expects_int (x ): # $int=field SPURIOUS: str=field
21+ do_int_stuff (x .field ) # $int int=field SPURIOUS: str str=field
2222
23- def expects_string (x ): # $f+:int =field $str =field
24- do_string_stuff (x .field ) # $f+:int $ str $f+: int=field $str =field
23+ def expects_string (x ): # $ str =field SPURIOUS: int =field
24+ do_string_stuff (x .field ) # $str str=field SPURIOUS: int int =field
2525
2626def test_incompatible_types ():
2727 x = SomeClass () # $int,str=field
28- x .field = int (5 ) # $int=field $f+: str=field $int $f+: str
29- expects_int (x ) # $int=field $f+: str=field
30- x .field = str ("Hello" ) # $f+:int =field $ str=field $f+: int $str
31- expects_string (x ) # $f+:int =field $str =field
28+ x .field = int (5 ) # $int=field int SPURIOUS: str=field str
29+ expects_int (x ) # $int=field SPURIOUS: str=field
30+ x .field = str ("Hello" ) # $str =field str SPURIOUS: int=field int
31+ expects_string (x ) # $ str =field SPURIOUS: int =field
3232
3333
3434# Attributes assigned statically to a class
3535
3636class MyClass : # $tracked=field
3737 field = tracked # $tracked
3838
39- lookup = MyClass .field # $tracked $ tracked=field
39+ lookup = MyClass .field # $tracked tracked=field
4040instance = MyClass () # $tracked=field
41- lookup2 = instance .field # $f-: tracked
41+ lookup2 = instance .field # MISSING: tracked
4242
4343## Dynamic attribute access
4444
4545# Via `getattr`/`setattr`
4646
4747def setattr_immediate_write ():
4848 x = SomeClass () # $tracked=foo
49- setattr (x ,"foo" , tracked ) # $tracked $ tracked=foo
50- y = x .foo # $tracked $ tracked=foo
49+ setattr (x ,"foo" , tracked ) # $tracked tracked=foo
50+ y = x .foo # $tracked tracked=foo
5151 do_stuff (y ) # $tracked
5252
5353def getattr_immediate_read ():
5454 x = SomeClass () # $tracked=foo
55- x .foo = tracked # $tracked $ tracked=foo
56- y = getattr (x ,"foo" ) # $tracked $ tracked=foo
55+ x .foo = tracked # $tracked tracked=foo
56+ y = getattr (x ,"foo" ) # $tracked tracked=foo
5757 do_stuff (y ) # $tracked
5858
5959def setattr_indirect_write ():
6060 attr = "foo"
6161 x = SomeClass () # $tracked=foo
62- setattr (x , attr , tracked ) # $tracked $ tracked=foo
63- y = x .foo # $tracked $ tracked=foo
62+ setattr (x , attr , tracked ) # $tracked tracked=foo
63+ y = x .foo # $tracked tracked=foo
6464 do_stuff (y ) # $tracked
6565
6666def getattr_indirect_read ():
6767 attr = "foo"
6868 x = SomeClass () # $tracked=foo
69- x .foo = tracked # $tracked $ tracked=foo
70- y = getattr (x , attr ) #$tracked $ tracked=foo
69+ x .foo = tracked # $tracked tracked=foo
70+ y = getattr (x , attr ) #$tracked tracked=foo
7171 do_stuff (y ) # $tracked
7272
7373# Via `__dict__` -- not currently implemented.
7474
7575def dunder_dict_immediate_write ():
76- x = SomeClass () # $f-: tracked=foo
77- x .__dict__ ["foo" ] = tracked # $tracked $f-: tracked=foo
78- y = x .foo # $f-: tracked $f-: tracked=foo
79- do_stuff (y ) # $f-: tracked
76+ x = SomeClass () # $ MISSING: tracked=foo
77+ x .__dict__ ["foo" ] = tracked # $tracked MISSING: tracked=foo
78+ y = x .foo # $ MISSING: tracked tracked=foo
79+ do_stuff (y ) # $ MISSING: tracked
8080
8181def dunder_dict_immediate_read ():
8282 x = SomeClass () # $tracked=foo
83- x .foo = tracked # $tracked $ tracked=foo
84- y = x .__dict__ ["foo" ] # $f-:tracked $ tracked=foo
85- do_stuff (y ) # $f-: tracked
83+ x .foo = tracked # $tracked tracked=foo
84+ y = x .__dict__ ["foo" ] # $ tracked=foo MISSING: tracked
85+ do_stuff (y ) # $ MISSING: tracked
8686
8787def dunder_dict_indirect_write ():
8888 attr = "foo"
89- x = SomeClass () # $f-: tracked=foo
90- x .__dict__ [attr ] = tracked # $tracked $f-: tracked=foo
91- y = x .foo # $f-: tracked $f-: tracked=foo
92- do_stuff (y ) # $f-: tracked
89+ x = SomeClass () # $ MISSING: tracked=foo
90+ x .__dict__ [attr ] = tracked # $tracked MISSING: tracked=foo
91+ y = x .foo # $ MISSING: tracked tracked=foo
92+ do_stuff (y ) # $ MISSING: tracked
9393
9494def dunder_dict_indirect_read ():
9595 attr = "foo"
9696 x = SomeClass () # $tracked=foo
97- x .foo = tracked # $tracked $ tracked=foo
98- y = x .__dict__ [attr ] # $f-:tracked $ tracked=foo
99- do_stuff (y ) # $f-: tracked
97+ x .foo = tracked # $tracked tracked=foo
98+ y = x .__dict__ [attr ] # $ tracked=foo MISSING: tracked
99+ do_stuff (y ) # $ MISSING: tracked
100100
101101
0 commit comments