|
| 1 | +# test of other content types than attributes |
| 2 | + |
| 3 | +def test_tuple(index_arg): |
| 4 | + tup = (tracked, other) # $tracked |
| 5 | + |
| 6 | + tup[0] # $ tracked |
| 7 | + tup[1] |
| 8 | + |
| 9 | + a,b = tup # $tracked |
| 10 | + a # $ tracked |
| 11 | + b |
| 12 | + |
| 13 | + # non-precise access is not supported right now (and it's not 100% clear if we want |
| 14 | + # to support it, or if it will lead to bad results) |
| 15 | + tup[index_arg] |
| 16 | + |
| 17 | + for x in tup: |
| 18 | + print(x) |
| 19 | + |
| 20 | + for i in range(len(tup)): |
| 21 | + print(tup[i]) |
| 22 | + |
| 23 | + |
| 24 | +def test_dict(key_arg): |
| 25 | + d1 = {"t": tracked, "o": other} # $tracked |
| 26 | + d1["t"] # $ tracked |
| 27 | + d1.get("t") # $ MISSING: tracked |
| 28 | + d1.setdefault("t") # $ MISSING: tracked |
| 29 | + |
| 30 | + d1["o"] |
| 31 | + d1.get("o") |
| 32 | + d1.setdefault("o") |
| 33 | + |
| 34 | + |
| 35 | + # non-precise access is not supported right now (and it's not 100% clear if we want |
| 36 | + # to support it, or if it will lead to bad results) |
| 37 | + d1[key_arg] |
| 38 | + |
| 39 | + for k in d1: |
| 40 | + d1[k] |
| 41 | + |
| 42 | + for v in d1.values(): |
| 43 | + v |
| 44 | + |
| 45 | + for k, v in d1.items(): |
| 46 | + v |
| 47 | + |
| 48 | + |
| 49 | + # construction with inline updates |
| 50 | + d2 = dict() |
| 51 | + d2["t"] = tracked # $ tracked |
| 52 | + d2["o"] = other |
| 53 | + |
| 54 | + d2["t"] # $ tracked |
| 55 | + d2["o"] |
| 56 | + |
| 57 | + # notice that time-travel is also possible (just as with attributes) |
| 58 | + d3 = dict() |
| 59 | + d3["t"] # $ SPURIOUS: tracked |
| 60 | + d3["t"] = tracked # $ tracked |
| 61 | + d3["t"] # $ tracked |
| 62 | + |
| 63 | + |
| 64 | +def test_list(index_arg): |
| 65 | + l = [tracked, other] # $tracked |
| 66 | + |
| 67 | + l[0] # $ MISSING: tracked |
| 68 | + l[1] |
| 69 | + |
| 70 | + # non-precise access is not supported right now (and it's not 100% clear if we want |
| 71 | + # to support it, or if it will lead to bad results) |
| 72 | + l[index_arg] |
| 73 | + |
| 74 | + for x in l: |
| 75 | + print(x) |
| 76 | + |
| 77 | + for i in range(len(l)): |
| 78 | + print(l[i]) |
0 commit comments