|
55 | 55 | ["z = [1,2,3]; [z[1], z[-1]]", [2, 3]],
|
56 | 56 | ["'{1} {0}'.format('one', 'two')", "two one"],
|
57 | 57 | ["'%d, %d' % (23, 45)", "23, 45"],
|
| 58 | + ["x = [[1,2,3]]; sum(*x)", 6], |
58 | 59 | ["args = [1, 5, 10]; {6, *args, 15}", {1, 5, 6, 10, 15}],
|
59 | 60 | ["args = [1, 5, 10]; [6, *args, 15]", [6, 1, 5, 10, 15]],
|
60 | 61 | ["kw = {'x': 1, 'y': 5}; {**kw}", {"x": 1, "y": 5}],
|
|
145 | 146 | "z = [1,2,3]; ((x, y), (z[2], t)) = ((1, 2), (20, 4)); [x, y, z, t]",
|
146 | 147 | [1, 2, [1, 2, 20], 4],
|
147 | 148 | ],
|
| 149 | + ["a, b, c = [1,2,3]; [a, b, c]", [1, 2, 3]], |
| 150 | + ["a, b, c = iter([1,2,3]); [a, b, c]", [1, 2, 3]], |
| 151 | + [ |
| 152 | + "tuples = [(1, 2), (3, 4), (5, 6)]; a, b = zip(*tuples); [a, b]", |
| 153 | + [(1, 3, 5), (2, 4, 6)], |
| 154 | + ], |
148 | 155 | ["Foo = type('Foo', (), {'x': 100}); Foo.x = 10; Foo.x", 10],
|
149 | 156 | ["Foo = type('Foo', (), {'x': 100}); Foo.x += 10; Foo.x", 110],
|
150 | 157 | ["Foo = [type('Foo', (), {'x': 100})]; Foo[0].x = 10; Foo[0].x", 10],
|
@@ -664,11 +671,19 @@ def test_eval(hass):
|
664 | 671 | ["xx", "Exception in test line 1 column 0: name 'xx' is not defined"],
|
665 | 672 | [
|
666 | 673 | "(x, y) = (1, 2, 4)",
|
667 |
| - "Exception in test line 1 column 16: too many values to unpack (expected 2)", |
| 674 | + "Exception in test line 1 column 4: too many values to unpack (expected 2)", |
| 675 | + ], |
| 676 | + [ |
| 677 | + "(x, y) = iter([1, 2, 4])", |
| 678 | + "Exception in test line 1 column 4: too many values to unpack (expected 2)", |
668 | 679 | ],
|
669 | 680 | [
|
670 | 681 | "(x, y, z) = (1, 2)",
|
671 |
| - "Exception in test line 1 column 16: too few values to unpack (expected 3)", |
| 682 | + "Exception in test line 1 column 4: too few values to unpack (expected 3)", |
| 683 | + ], |
| 684 | + [ |
| 685 | + "(x, y, z) = iter([1, 2])", |
| 686 | + "Exception in test line 1 column 4: too few values to unpack (expected 3)", |
672 | 687 | ],
|
673 | 688 | [
|
674 | 689 | "(x, y) = 1",
|
|
0 commit comments