Files
ruff/crates/red_knot_python_semantic/resources/mdtest/diagnostics/unpacking.md
Andrew Gallant 298f43f34e red_knot_python_semantic: add invalid assignment diagnostic snapshot
This tests the diagnostic rendering of a case that wasn't previously
covered by snapshots: when unpacking fails because there are too few
values, but where the left hand side can tolerate "N or more." In the
code, this is a distinct diagnostic, so we capture it here.

(Sorry about the diff here, but it made sense to rename the other
sections and that changes the name of the snapshot file.)
2025-04-22 12:08:03 -04:00

403 B

Unpacking

Right hand side not iterable

a, b = 1  # error: [not-iterable]

Exactly too many values to unpack

a, b = (1, 2, 3)  # error: [invalid-assignment]

Exactly too few values to unpack

a, b = (1,)  # error: [invalid-assignment]

Too few values to unpack

[a, *b, c, d] = (1, 2)  # error: [invalid-assignment]