More detailed testing for value-error-too-few-values.

This commit is contained in:
Dave Halter
2015-12-14 06:54:02 +01:00
parent 7b8d4e86ac
commit c85426ebac
2 changed files with 4 additions and 1 deletions

View File

@@ -401,7 +401,7 @@ def unpack_tuple_to_dict(evaluator, types, exprlist):
else: else:
dct.update(unpack_tuple_to_dict(evaluator, iter_types, part)) dct.update(unpack_tuple_to_dict(evaluator, iter_types, part))
has_parts = next(parts, None) has_parts = next(parts, None)
if n > 0 and has_parts is not None: if types and has_parts is not None:
analysis.add(evaluator, 'value-error-too-few-values', has_parts, analysis.add(evaluator, 'value-error-too-few-values', has_parts,
message="ValueError: need more than %s values to unpack" % n) message="ValueError: need more than %s values to unpack" % n)
return dct return dct

View File

@@ -15,4 +15,7 @@ for x, y in dct:
# Shouldn't cause issues, because if there are no types (or we don't know what # Shouldn't cause issues, because if there are no types (or we don't know what
# the types are, we should just ignore it. # the types are, we should just ignore it.
#! 0 value-error-too-few-values
a, b = [] a, b = []
#! 7 name-error
a, b = NOT_DEFINED