FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Update test/test_unpack.py from CPython 3.11.2 by dalinaum · Pull Request #4676 · RustPython/RustPython · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
30 changes: 25 additions & 5 deletions Lib/test/test_unpack.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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()

Back | FazBrowse Home | New Git URL