Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit294f53a

Browse files
committed
add pylong_import() tests on normalize + singletons
1 parentb67b73a commit294f53a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

‎Lib/test/test_capi/test_long.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,13 @@ def test_long_import(self):
787787
self.assertEqual(pylong_import(0, [1,2,3]),
788788
shift**2*3+shift*2+1)
789789

790+
# normalize
791+
self.assertEqual(pylong_import(0, [123,0,0]),123)
792+
793+
# test singletons + normalize
794+
fornumin (-2,0,1,5,42,100):
795+
self.assertIs(pylong_import(bool(num<0), [abs(num),0]),num)
796+
790797
# round trip: Python int -> export -> Python int
791798
pylong_export=_testcapi.pylong_export
792799
numbers= [*range(0,10),12345,0xdeadbeef,2**100,2**100-1]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp