-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix map no iterables #8478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix map no iterables #8478
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -24,6 +24,13 @@ def __iter__(self): | |||||||||||||
| assert next(it) == 2 | ||||||||||||||
| assert next(it) == 3 | ||||||||||||||
|
|
||||||||||||||
| # test for no iterables | ||||||||||||||
| try: | ||||||||||||||
| map(lambda: 1) | ||||||||||||||
| assert False, "TypeError expected at map construction" | ||||||||||||||
| except TypeError as e: | ||||||||||||||
| assert str(e) == "map() must have at least two arguments." | ||||||||||||||
|
|
||||||||||||||
|
Comment on lines
+27
to
+33
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Cover the keyword construction path before merging. This test only exercises positional construction. Add a case such as 🧰 Tools🪛 Ruff (0.16.1)[warning] 30-30: Do not Replace (B011) 🤖 Prompt for AI Agents
Comment on lines
+27
to
+33
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Ah, ok. by looking the test result, this case is well-covered by test_itertools Please remove this our own test. And also check CI result that your patch made success. Please remove |
||||||||||||||
|
|
||||||||||||||
| def mapping(x): | ||||||||||||||
| if x == 0: | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: RustPython/RustPython
Length of output: 485
🏁 Script executed:
Repository: RustPython/RustPython
Length of output: 250
🏁 Script executed:
Repository: RustPython/RustPython
Length of output: 233
🏁 Script executed:
Repository: RustPython/RustPython
Length of output: 1368
🏁 Script executed:
Repository: RustPython/RustPython
Length of output: 490
🏁 Script executed:
Repository: RustPython/RustPython
Length of output: 1728
Use explicit
AssertionErrorcontrol flow.assert Falseraises a lint error, andpython -Oremoves it, so this branch can pass without catching the constructorTypeErroror comparing the required message. RaiseAssertionErrorfor the expected failure, then checkstr(e) == "map() must have at least two arguments."explicitly.🧰 Tools
🪛 Ruff (0.16.1)
[warning] 30-30: Do not
assert False(python -Oremoves these calls), raiseAssertionError()Replace
assert False(B011)
🤖 Prompt for AI Agents
Sources: Coding guidelines, Linters/SAST tools