Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Update test/test_unpack.py from CPython 3.11.2 #4676

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

Merged
merged 1 commit into from
Mar 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions 30 Lib/test/test_unpack.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import doctest
import unittest


doctests = """

Unpack tuple
Expand Down Expand Up @@ -142,10 +146,26 @@

__test__ = {'doctests' : doctests}

def test_main(verbose=False):
from test import support
from test import test_unpack
support.run_doctest(test_unpack, verbose)
def load_tests(loader, tests, pattern):
tests.addTest(doctest.DocTestSuite())
return tests


class TestCornerCases(unittest.TestCase):
def test_extended_oparg_not_ignored(self):
# https://github.com/python/cpython/issues/91625
target = "(" + "y,"*400 + ")"
code = f"""def unpack_400(x):
{target} = x
return y
"""
ns = {}
exec(code, ns)
unpack_400 = ns["unpack_400"]
# Warm up the the function for quickening (PEP 659)
for _ in range(30):
y = unpack_400(range(400))
self.assertEqual(y, 399)

if __name__ == "__main__":
test_main(verbose=True)
unittest.main()
Morty Proxy This is a proxified and sanitized view of the page, visit original site.