KEMBAR78
Skip checking number of interpolations for string formatting when rhs_type is an Iterable type by 97littleleaf11 · Pull Request #11319 · python/mypy · GitHub
Skip to content

Conversation

97littleleaf11
Copy link
Collaborator

Description

Closes #7764

Test Plan

  • Move string formatting test cases into a new file.
  • Add a new test [testStringInterpolationIterableType]

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm it would be more consistent to not complain about iterable types as the RHS, since the number of items could be correct. For example, mypy doesn't complain about this code, which feels quite similar:

a = [1]
x, y = a  # No error, since the number of items could be 2 (mypy doesn't know)

@JukkaL
Copy link
Collaborator

JukkaL commented Oct 13, 2021

For a cleaner commit history, it would be nice to have a separate PR that moves the test cases to a new file. If the refactoring is included with the functionality change and somebody would look at the commit history, it could be a little difficult to find the new test case. This is one reason why I usually prefer refactorings in separate PRs.

@97littleleaf11 97littleleaf11 changed the title Change error message for string formatting when rhs_type is an Iterable type Skip checking number of interpolations for string formatting when rhs_type is an Iterable type Oct 14, 2021
@97littleleaf11 97littleleaf11 requested a review from JukkaL October 14, 2021 10:24
Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates! Looks good.

@JukkaL JukkaL merged commit a114826 into python:master Oct 14, 2021
@97littleleaf11 97littleleaf11 deleted the fix-7764 branch October 14, 2021 13:43
tushar-deepsource pushed a commit to DeepSourceCorp/mypy that referenced this pull request Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False positive [str-format] for Sequence[]

2 participants