summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2007-12-03 21:02:03 (GMT)
committerChristian Heimes <christian@cheimes.de>2007-12-03 21:02:03 (GMT)
commitcbf3b5cb76906fba15dbf59a1e83c540a447b907 (patch)
tree191de62298cf0af90595802cd47cff23d8f39d80 /Lib/test
parentf9290773fc026c5064fa96e1d06c3924e49fa89b (diff)
downloadcpython-cbf3b5cb76906fba15dbf59a1e83c540a447b907.zip
cpython-cbf3b5cb76906fba15dbf59a1e83c540a447b907.tar.gz
cpython-cbf3b5cb76906fba15dbf59a1e83c540a447b907.tar.bz2
Merged revisions 59275-59303 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! NOTE: The merge does NOT contain the modified file Python/import.c from r59288. I can't get it running. Nick, please check in the PEP 366 manually. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ........ r59279 | georg.brandl | 2007-12-02 19:17:50 +0100 (Sun, 02 Dec 2007) | 2 lines Fix a sentence I missed before. Do not merge to 3k. ........ r59281 | georg.brandl | 2007-12-02 22:58:54 +0100 (Sun, 02 Dec 2007) | 3 lines Add documentation for PySys_* functions. Written by Charlie Shepherd for GHOP. Also fixes #1245. ........ r59288 | nick.coghlan | 2007-12-03 13:55:17 +0100 (Mon, 03 Dec 2007) | 1 line Implement PEP 366 ........ r59290 | christian.heimes | 2007-12-03 14:47:29 +0100 (Mon, 03 Dec 2007) | 3 lines Applied my patch #1455 with some extra fixes for VS 2005 The new msvc9compiler module supports VS 2005 and VS 2008. I've also fixed build_ext to support PCbuild8 and PCbuild9 and backported my fix for xxmodule.c from py3k. The old code msvccompiler is still in place in case somebody likes to build an extension with VS 2003 or earlier. I've also updated the cygwin compiler module for VS 2005 and VS 2008. It works with VS 2005 but I'm unable to test it with VS 2008. We have to wait for a new version of cygwin. ........ r59291 | christian.heimes | 2007-12-03 14:55:16 +0100 (Mon, 03 Dec 2007) | 1 line Added comment to Misc/NEWS for r59290 ........ r59292 | christian.heimes | 2007-12-03 15:28:04 +0100 (Mon, 03 Dec 2007) | 1 line I followed MA Lemberg's suggestion and added comments to the late initialization of the type slots. ........ r59293 | facundo.batista | 2007-12-03 17:29:52 +0100 (Mon, 03 Dec 2007) | 3 lines Speedup and cleaning of __str__. Thanks Mark Dickinson. ........ r59294 | facundo.batista | 2007-12-03 18:55:00 +0100 (Mon, 03 Dec 2007) | 4 lines Faster _fix function, and some reordering for a more elegant coding. Thanks Mark Dickinson. ........ r59295 | martin.v.loewis | 2007-12-03 20:20:02 +0100 (Mon, 03 Dec 2007) | 5 lines Issue #1727780: Support loading pickles of random.Random objects created on 32-bit systems on 64-bit systems, and vice versa. As a consequence of the change, Random pickles created by Python 2.6 cannot be loaded in Python 2.5. ........ r59297 | facundo.batista | 2007-12-03 20:49:54 +0100 (Mon, 03 Dec 2007) | 3 lines Two small fixes. Issue 1547. ........ r59299 | georg.brandl | 2007-12-03 20:57:02 +0100 (Mon, 03 Dec 2007) | 2 lines #1548: fix apostroph placement. ........ r59300 | christian.heimes | 2007-12-03 21:01:02 +0100 (Mon, 03 Dec 2007) | 3 lines Patch #1537 from Chad Austin Change GeneratorExit's base class from Exception to BaseException (This time I'm applying the patch to the correct sandbox.) ........ r59302 | georg.brandl | 2007-12-03 21:03:46 +0100 (Mon, 03 Dec 2007) | 3 lines Add examples to the xmlrpclib docs. Written for GHOP by Josip Dzolonga. ........
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/exception_hierarchy.txt2
-rw-r--r--Lib/test/randv2_32.pck633
-rw-r--r--Lib/test/randv2_64.pck633
-rw-r--r--Lib/test/randv3.pck633
-rw-r--r--Lib/test/test_cmd_line_script.py94
-rw-r--r--Lib/test/test_frozen.py10
-rw-r--r--Lib/test/test_generators.py15
-rw-r--r--Lib/test/test_pkg.py24
-rw-r--r--Lib/test/test_random.py13
-rw-r--r--Lib/test/test_runpy.py33
10 files changed, 2039 insertions, 51 deletions
diff --git a/Lib/test/exception_hierarchy.txt b/Lib/test/exception_hierarchy.txt
index 965252c..73ccb66 100644
--- a/Lib/test/exception_hierarchy.txt
+++ b/Lib/test/exception_hierarchy.txt
@@ -1,8 +1,8 @@
BaseException
+-- SystemExit
+-- KeyboardInterrupt
+ +-- GeneratorExit
+-- Exception
- +-- GeneratorExit
+-- StopIteration
+-- ArithmeticError
| +-- FloatingPointError
diff --git a/Lib/test/randv2_32.pck b/Lib/test/randv2_32.pck
new file mode 100644
index 0000000..587ab24
--- /dev/null
+++ b/Lib/test/randv2_32.pck
@@ -0,0 +1,633 @@
+crandom
+Random
+p0
+(tRp1
+(I2
+(I-2147483648
+I-845974985
+I-1294090086
+I1193659239
+I-1849481736
+I-946579732
+I-34406770
+I1749049471
+I1997774682
+I1432026457
+I1288127073
+I-943175655
+I-1718073964
+I339993548
+I-1045260575
+I582505037
+I-1555108250
+I-1114765620
+I1578648750
+I-350384412
+I-20845848
+I-288255314
+I738790953
+I1901249641
+I1999324672
+I-277361068
+I-1515885839
+I2061761596
+I-809068089
+I1287981136
+I258129492
+I-6303745
+I-765148337
+I1090344911
+I1653434703
+I-1242923628
+I1639171313
+I-1870042660
+I-1655014050
+I345609048
+I2093410138
+I1963263374
+I-2122098342
+I1336859961
+I-810942729
+I945857753
+I2103049942
+I623922684
+I1418349549
+I690877342
+I754973107
+I-1605111847
+I1607137813
+I-1704917131
+I1317536428
+I1714882872
+I-1665385120
+I1823694397
+I-1790836866
+I-1696724812
+I-603979847
+I-498599394
+I-341265291
+I927388804
+I1778562135
+I1716895781
+I1023198122
+I1726145967
+I941955525
+I1240148950
+I-1929634545
+I-1288147083
+I-519318335
+I754559777
+I-707571958
+I374604022
+I420424061
+I-1095443486
+I1621934944
+I-1220502522
+I-140049608
+I-918917122
+I304341024
+I-1637446057
+I-353934485
+I1973436235
+I433380241
+I-686759465
+I-2111563154
+I-573422032
+I804304541
+I1513063483
+I1417381689
+I-804778729
+I211756408
+I544537322
+I890881641
+I150378374
+I1765739392
+I1011604116
+I584889095
+I1400520554
+I413747808
+I-1741992587
+I-1882421574
+I-1373001903
+I-1885348538
+I903819480
+I1083220038
+I-1318105424
+I1740421404
+I1693089625
+I775965557
+I1319608037
+I-2127475785
+I-367562895
+I-1416273451
+I1693000327
+I-1217438421
+I834405522
+I-128287275
+I864057548
+I-973917356
+I7304111
+I1712253182
+I1353897741
+I672982288
+I1778575559
+I-403058377
+I-38540378
+I-1393713496
+I13193171
+I1127196200
+I205176472
+I-2104790506
+I299985416
+I1403541685
+I-1018270667
+I-1980677490
+I-1182625797
+I1637015181
+I-1795357414
+I1514413405
+I-924516237
+I-1841873650
+I-1014591269
+I1576616065
+I-1319103135
+I-120847840
+I2062259778
+I-9285070
+I1160890300
+I-575137313
+I-1509108275
+I46701926
+I-287560914
+I-256824960
+I577558250
+I900598310
+I944607867
+I2121154920
+I-1170505192
+I-1347170575
+I77247778
+I-1899015765
+I1234103327
+I1027053658
+I1934632322
+I-792031234
+I1147322536
+I1290655117
+I1002059715
+I1325898538
+I896029793
+I-790940694
+I-980470721
+I-1922648255
+I-951672814
+I291543943
+I1158740218
+I-1959023736
+I-1977185236
+I1527900076
+I514104195
+I-814154113
+I-593157883
+I-1023704660
+I1285688377
+I-2117525386
+I768954360
+I-38676846
+I-799848659
+I-1305517259
+I-1938213641
+I-462146758
+I-1663302892
+I1899591069
+I-22935388
+I-275856976
+I-443736893
+I-739441156
+I93862068
+I-838105669
+I1735629845
+I-817484206
+I280814555
+I1753547179
+I1811123479
+I1974543632
+I-48447465
+I-642694345
+I-531149613
+I518698953
+I-221642627
+I-686519187
+I776644303
+I257774400
+I-1499134857
+I-1055273455
+I-237023943
+I1981752330
+I-917671662
+I-372905983
+I1588058420
+I1171936660
+I-1730977121
+I1360028989
+I1769469287
+I1910709542
+I-852692959
+I1396944667
+I-1723999155
+I-310975435
+I-1965453954
+I-1636858570
+I2005650794
+I680293715
+I1355629386
+I844514684
+I-1909152807
+I-808646074
+I1936510018
+I1134413810
+I-143411047
+I-1478436304
+I1394969244
+I-1170110660
+I1963112086
+I-1518351049
+I-1506287443
+I-455023090
+I-855366028
+I-1746785568
+I933990882
+I-703625141
+I-285036872
+I188277905
+I1471578620
+I-981382835
+I-586974220
+I945619758
+I1608778444
+I-1708548066
+I-1897629320
+I-42617810
+I-836840790
+I539154487
+I-235706962
+I332074418
+I-575700589
+I1534608003
+I632116560
+I-1819760653
+I642052958
+I-722391771
+I-1104719475
+I-1196847084
+I582413973
+I1563394876
+I642007944
+I108989456
+I361625014
+I677308625
+I-1806529496
+I-959050708
+I-1858251070
+I-216069832
+I701624579
+I501238033
+I12287030
+I1895107107
+I2089098638
+I-874806230
+I1236279203
+I563718890
+I-544352489
+I-1879707498
+I1767583393
+I-1776604656
+I-693294301
+I-88882831
+I169303357
+I1299196152
+I-1122791089
+I-379157172
+I1934671851
+I1575736961
+I-19573174
+I-1401511009
+I9305167
+I-1115174467
+I1670735537
+I1226436501
+I-2004524535
+I1767463878
+I-1722855079
+I-559413926
+I1529810851
+I1201272087
+I-1297130971
+I-1188149982
+I1396557188
+I-370358342
+I-1006619702
+I1600942463
+I906087130
+I-76991909
+I2069580179
+I-1674195181
+I-2098404729
+I-940972459
+I-573399187
+I-1930386277
+I-721311199
+I-647834744
+I1452181671
+I688681916
+I1812793731
+I1704380620
+I-1389615179
+I866287837
+I-1435265007
+I388400782
+I-147986600
+I-1613598851
+I-1040347408
+I782063323
+I-239282031
+I-575966722
+I-1865208174
+I-481365146
+I579572803
+I-1239481494
+I335361280
+I-429722947
+I1881772789
+I1908103808
+I1653690013
+I-1668588344
+I1933787953
+I-2033480609
+I22162797
+I-1516527040
+I-461232482
+I-16201372
+I-2043092030
+I114990337
+I-1524090084
+I1456374020
+I458606440
+I-1928083218
+I227773125
+I-1129028159
+I1678689
+I1575896907
+I-1792935220
+I-151387575
+I64084088
+I-95737215
+I1337335688
+I-1963466345
+I1243315130
+I-1798518411
+I-546013212
+I-607065396
+I1219824160
+I1715218469
+I-1368163783
+I1701552913
+I-381114888
+I1068821717
+I266062971
+I-2066513172
+I1767407229
+I-780936414
+I-705413443
+I-1256268847
+I1646874149
+I1107690353
+I839133072
+I67001749
+I860763503
+I884880613
+I91977084
+I755371933
+I420745153
+I-578480690
+I-1520193551
+I1011369331
+I-99754575
+I-733141064
+I-500598588
+I1081124271
+I-1341266575
+I921002612
+I-848852487
+I-1904467341
+I-1294256973
+I-94074714
+I-1778758498
+I-1401188547
+I2101830578
+I2058864877
+I-272875991
+I-1375854779
+I-1332937870
+I619425525
+I-1034529639
+I-36454393
+I-2030499985
+I-1637127500
+I-1408110287
+I-2108625749
+I-961007436
+I1475654951
+I-791946251
+I1667792115
+I1818978830
+I1897980514
+I1959546477
+I-74478911
+I-508643347
+I461594399
+I538802715
+I-2094970071
+I-2076660253
+I1091358944
+I1944029246
+I-343957436
+I-1915845022
+I1237620188
+I1144125174
+I1522190520
+I-670252952
+I-19469226
+I675626510
+I758750096
+I909724354
+I-1846259652
+I544669343
+I445182495
+I-821519930
+I-1124279685
+I-1668995122
+I1653284793
+I-678555151
+I-687513207
+I1558259445
+I-1978866839
+I1558835601
+I1732138472
+I-1904793363
+I620020296
+I1562597874
+I1942617227
+I-549632552
+I721603795
+I417978456
+I-1355281522
+I-538065208
+I-1079523196
+I187375699
+I449064972
+I1018083947
+I1632388882
+I-493269866
+I92769041
+I1477146750
+I1782708404
+I444873376
+I1085851104
+I-6823272
+I-1302251853
+I1602050688
+I-1042187824
+I287161745
+I-1972094479
+I103271491
+I2131619773
+I-2064115870
+I766815498
+I990861458
+I-1664407378
+I1083746756
+I-1018331904
+I-677315687
+I-951670647
+I-952356874
+I451460609
+I-818615564
+I851439508
+I656362634
+I-1351240485
+I823378078
+I1985597385
+I597757740
+I-1512303057
+I1590872798
+I1108424213
+I818850898
+I-1368594306
+I-201107761
+I1793370378
+I1247597611
+I-1594326264
+I-601653890
+I427642759
+I248322113
+I-292545338
+I1708985870
+I1917042771
+I429354503
+I-478470329
+I793960014
+I369939133
+I1728189157
+I-518963626
+I-278523974
+I-1877289696
+I-2088617658
+I-1367940049
+I-62295925
+I197975119
+I-252900777
+I803430539
+I485759441
+I-528283480
+I-1287443963
+I-478617444
+I-861906946
+I-649095555
+I-893184337
+I2050571322
+I803433133
+I1629574571
+I1649720417
+I-2050225209
+I1208598977
+I720314344
+I-615166251
+I-835077127
+I-1405372429
+I995698064
+I148123240
+I-943016676
+I-594609622
+I-1381596711
+I1017195301
+I-1268893013
+I-1815985179
+I-1393570351
+I-870027364
+I-476064472
+I185582645
+I569863326
+I1098584267
+I-1599147006
+I-485054391
+I-852098365
+I1477320135
+I222316762
+I-1515583064
+I-935051367
+I393383063
+I819617226
+I722921837
+I-1241806499
+I-1358566385
+I1666813591
+I1333875114
+I-1663688317
+I-47254623
+I-885800726
+I307388991
+I-1219459496
+I1374870300
+I2132047877
+I-1385624198
+I-245139206
+I1015139214
+I-926198559
+I1969798868
+I-1950480619
+I-559193432
+I-1256446518
+I-1983476981
+I790179655
+I1004289659
+I1541827617
+I1555805575
+I501127333
+I-1123446797
+I-453230915
+I2035104883
+I1296122398
+I-1843698604
+I-715464588
+I337143971
+I-1972119192
+I606777909
+I726977302
+I-1149501872
+I-1963733522
+I-1797504644
+I624
+tp2
+Ntp3
+b. \ No newline at end of file
diff --git a/Lib/test/randv2_64.pck b/Lib/test/randv2_64.pck
new file mode 100644
index 0000000..090dd6f
--- /dev/null
+++ b/Lib/test/randv2_64.pck
@@ -0,0 +1,633 @@
+crandom
+Random
+p0
+(tRp1
+(I2
+(I2147483648
+I1812115682
+I2741755497
+I1028055730
+I809166036
+I2773628650
+I62321950
+I535290043
+I349877800
+I976167039
+I2490696940
+I3631326955
+I2107991114
+I2941205793
+I3199611605
+I1871971556
+I1456108540
+I2984591044
+I140836801
+I4203227310
+I3652722980
+I4031971234
+I555769760
+I697301296
+I2347638880
+I3302335858
+I320255162
+I2553586608
+I1570224361
+I2838780912
+I2315834918
+I2351348158
+I3545433015
+I2292018579
+I1177569331
+I758497559
+I2913311175
+I1014948880
+I1793619243
+I3982451053
+I3850988342
+I2393984324
+I1583100093
+I3144742543
+I3655047493
+I3507532385
+I3094515442
+I350042434
+I2455294844
+I1038739312
+I313809152
+I189433072
+I1653165452
+I4186650593
+I19281455
+I2589680619
+I4145931590
+I4283266118
+I636283172
+I943618337
+I3170184633
+I2308766231
+I634615159
+I538152647
+I2079576891
+I1029442616
+I3410689412
+I1370292761
+I1071718978
+I2139496322
+I1876699543
+I3485866187
+I3157490130
+I1633105386
+I1453253160
+I3841322080
+I3789608924
+I4110770792
+I95083673
+I931354627
+I2065389591
+I3448339827
+I3348204577
+I3263528560
+I2411324590
+I4003055026
+I1869670093
+I2737231843
+I4150701155
+I2689667621
+I2993263224
+I3239890140
+I1191430483
+I1214399779
+I3623428533
+I1817058866
+I3052274451
+I326030082
+I1505129312
+I2306812262
+I1349150363
+I1099127895
+I2543465574
+I2396380193
+I503926466
+I1607109730
+I3451716817
+I58037114
+I4290081119
+I947517597
+I3083440186
+I520522630
+I2948962496
+I4184319574
+I2957636335
+I668374201
+I2325446473
+I472785314
+I3791932366
+I573017189
+I2185725379
+I1262251492
+I3525089379
+I2951262653
+I1305347305
+I940958122
+I3343754566
+I359371744
+I3874044973
+I396897232
+I147188248
+I716683703
+I4013880315
+I1133359586
+I1794612249
+I3480815192
+I3988787804
+I1729355809
+I573408542
+I1419310934
+I1770030447
+I3552845567
+I1693976502
+I1271189893
+I2298236738
+I2049219027
+I3464198070
+I1233574082
+I1007451781
+I1838253750
+I687096593
+I1131375603
+I1223013895
+I1490478435
+I339265439
+I4232792659
+I491538536
+I2816256769
+I1044097522
+I2566227049
+I748762793
+I1511830494
+I3593259822
+I4121279213
+I3735541309
+I3609794797
+I1939942331
+I377570434
+I1437957554
+I1831285696
+I55062811
+I2046783110
+I1303902283
+I1838349877
+I420993556
+I1256392560
+I2795216506
+I2783687924
+I3322303169
+I512794749
+I308405826
+I517164429
+I3320436022
+I1328403632
+I2269184746
+I3729522810
+I3304314450
+I2238756124
+I1690581361
+I3813277532
+I4119706879
+I2659447875
+I388818978
+I2064580814
+I1586227676
+I2627522685
+I2017792269
+I547928109
+I859107450
+I1062238929
+I858886237
+I3795783146
+I4173914756
+I3835915965
+I3329504821
+I3494579904
+I838863205
+I3399734724
+I4247387481
+I3618414834
+I2984433798
+I2165205561
+I4260685684
+I3045904244
+I3450093836
+I3597307595
+I3215851166
+I3162801328
+I2558283799
+I950068105
+I1829664117
+I3108542987
+I2378860527
+I790023460
+I280087750
+I1171478018
+I2333653728
+I3976932140
+I896746152
+I1802494195
+I1232873794
+I2749440836
+I2032037296
+I2012091682
+I1296131034
+I3892133385
+I908161334
+I2296791795
+I548169794
+I696265
+I893156828
+I426904709
+I3565374535
+I2655906825
+I2792178515
+I2406814632
+I4038847579
+I3123934642
+I2197503004
+I3535032597
+I2266216689
+I2117613462
+I1787448518
+I1875089416
+I2037165384
+I1140676321
+I3606296464
+I3229138231
+I2458267132
+I1874651171
+I3331900867
+I1000557654
+I1432861701
+I473636323
+I2691783927
+I1871437447
+I1328016401
+I4118690062
+I449467602
+I681789035
+I864889442
+I1200888928
+I75769445
+I4008690037
+I2464577667
+I4167795823
+I3070097648
+I2579174882
+I1216886568
+I3810116343
+I2249507485
+I3266903480
+I3671233480
+I100191658
+I3087121334
+I365063087
+I3821275176
+I2165052848
+I1282465245
+I3601570637
+I3132413236
+I2780570459
+I3222142917
+I3129794692
+I2611590811
+I947031677
+I2991908938
+I750997949
+I3632575131
+I1632014461
+I2846484755
+I2347261779
+I2903959448
+I1397316686
+I1904578392
+I774649578
+I3164598558
+I2429587609
+I738244516
+I1563304975
+I1399317414
+I1021316297
+I3187933234
+I2126780757
+I4011907847
+I4095169219
+I3358010054
+I2729978247
+I3736811646
+I3009656410
+I2893043637
+I4027447385
+I1239610110
+I1488806900
+I2674866844
+I442876374
+I2853687260
+I2785921005
+I3151378528
+I1180567
+I2803146964
+I982221759
+I2192919417
+I3087026181
+I2480838002
+I738452921
+I687986185
+I3049371676
+I3636492954
+I3468311299
+I2379621102
+I788988633
+I1643210601
+I2983998168
+I2492730801
+I2586048705
+I604073029
+I4121082815
+I1496476928
+I2972357110
+I2663116968
+I2642628592
+I2116052039
+I487186279
+I2577680328
+I3974766614
+I730776636
+I3842528855
+I1929093695
+I44626622
+I3989908833
+I1695426222
+I3675479382
+I3051784964
+I1514876613
+I1254036595
+I2420450649
+I3034377361
+I2332990590
+I1535175126
+I185834384
+I1107372900
+I1707278185
+I1286285295
+I3332574225
+I2785672437
+I883170645
+I2005666473
+I3403131327
+I4122021352
+I1464032858
+I3702576112
+I260554598
+I1837731650
+I2594435345
+I75771049
+I2012484289
+I3058649775
+I29979703
+I3861335335
+I2506495152
+I3786448704
+I442947790
+I2582724774
+I4291336243
+I2568189843
+I1923072690
+I1121589611
+I837696302
+I3284631720
+I3865021324
+I3576453165
+I2559531629
+I1459231762
+I3506550036
+I3754420159
+I2622000757
+I124228596
+I1084328605
+I1692830753
+I547273558
+I674282621
+I655259103
+I3188629610
+I490502174
+I2081001293
+I3191330704
+I4109943593
+I1859948504
+I3163806460
+I508833168
+I1256371033
+I2709253790
+I2068956572
+I3092842814
+I3913926529
+I2039638759
+I981982529
+I536094190
+I368855295
+I51993975
+I1597480732
+I4058175522
+I2155896702
+I3196251991
+I1081913893
+I3952353788
+I3545548108
+I2370669647
+I2206572308
+I2576392991
+I1732303374
+I1153136290
+I537641955
+I1738691747
+I3232854186
+I2539632206
+I2829760278
+I3058187853
+I1202425792
+I3762361970
+I2863949342
+I2640635867
+I376638744
+I1857679757
+I330798087
+I1457400505
+I1135610046
+I606400715
+I1859536026
+I509811335
+I529772308
+I2579273244
+I1890382004
+I3959908876
+I2612335971
+I2834052227
+I1434475986
+I3684202717
+I4015011345
+I582567852
+I3689969571
+I3934753460
+I3034960691
+I208573292
+I4004113742
+I3992904842
+I2587153719
+I3529179079
+I1565424987
+I779130678
+I1048582935
+I3213591622
+I3607793434
+I3951254937
+I2047811901
+I7508850
+I248544605
+I4210090324
+I2331490884
+I70057213
+I776474945
+I1345528889
+I3290403612
+I1664955269
+I1533143116
+I545003424
+I4141564478
+I1257326139
+I868843601
+I2337603029
+I1918131449
+I1843439523
+I1125519035
+I673340118
+I421408852
+I1520454906
+I1804722630
+I3621254196
+I2329968000
+I39464672
+I430583134
+I294026512
+I53978525
+I2892276105
+I1418863764
+I3419054451
+I1391595797
+I3544981798
+I4191780858
+I825672357
+I2972000844
+I1571305069
+I4231982845
+I3611916419
+I3045163168
+I2982349733
+I278572141
+I4215338078
+I839860504
+I1819151779
+I1412347479
+I1386770353
+I3914589491
+I3783104977
+I4124296733
+I830546258
+I89825624
+I4110601328
+I2545483429
+I300600527
+I516641158
+I3693021034
+I2852912854
+I3240039868
+I4167407959
+I1479557946
+I3621188804
+I1391590944
+I3578441128
+I1227055556
+I406898396
+I3064054983
+I25835338
+I402664165
+I4097682779
+I2106728012
+I203613622
+I3045467686
+I1381726438
+I3798670110
+I1342314961
+I3552497361
+I535913619
+I2625787583
+I1606574307
+I1101269630
+I1950513752
+I1121355862
+I3586816903
+I438529984
+I2473182121
+I1229997203
+I405445940
+I1695535315
+I427014336
+I3916768430
+I392298359
+I1884642868
+I1244730821
+I741058080
+I567479957
+I3527621168
+I3191971011
+I3267069104
+I4108668146
+I1520795587
+I166581006
+I473794477
+I1562126550
+I929843010
+I889533294
+I1266556608
+I874518650
+I3520162092
+I3013765049
+I4220231414
+I547246449
+I3998093769
+I3737193746
+I3872944207
+I793651876
+I2606384318
+I875991012
+I1394836334
+I4102011644
+I854380426
+I2618666767
+I2568302000
+I1995512132
+I229491093
+I2673500286
+I3364550739
+I3836923416
+I243656987
+I3944388983
+I4064949677
+I1416956378
+I1703244487
+I3990798829
+I2023425781
+I3926702214
+I1229015501
+I3174247824
+I624
+tp2
+Ntp3
+b. \ No newline at end of file
diff --git a/Lib/test/randv3.pck b/Lib/test/randv3.pck
new file mode 100644
index 0000000..09fc38b
--- /dev/null
+++ b/Lib/test/randv3.pck
@@ -0,0 +1,633 @@
+crandom
+Random
+p0
+(tRp1
+(I3
+(L2147483648L
+L994081831L
+L2806287265L
+L2228999830L
+L3396498069L
+L2956805457L
+L3273927761L
+L920726507L
+L1862624492L
+L2921292485L
+L1779526843L
+L2469105503L
+L251696293L
+L1254390717L
+L779197080L
+L3165356830L
+L2007365218L
+L1870028812L
+L2896519363L
+L1855578438L
+L979518416L
+L3481710246L
+L3191861507L
+L3993006593L
+L2967971479L
+L3353342753L
+L3576782572L
+L339685558L
+L2367675732L
+L116208555L
+L1220054437L
+L486597056L
+L1912115141L
+L1037044792L
+L4096904723L
+L3409146175L
+L3701651227L
+L315824610L
+L4138604583L
+L1385764892L
+L191878900L
+L2320582219L
+L3420677494L
+L2776503169L
+L1148247403L
+L829555069L
+L902064012L
+L2934642741L
+L2477108577L
+L2583928217L
+L1658612579L
+L2865447913L
+L129147346L
+L3691171887L
+L1569328110L
+L1372860143L
+L1054139183L
+L1617707080L
+L69020592L
+L3810271603L
+L1853953416L
+L3499803073L
+L1027545027L
+L3229043605L
+L250848720L
+L3324932626L
+L3537002962L
+L2494323345L
+L3238103962L
+L4147541579L
+L3636348186L
+L3025455083L
+L2678771977L
+L584700256L
+L3461826909L
+L854511420L
+L943463552L
+L3609239025L
+L3977577989L
+L253070090L
+L777394544L
+L2144086567L
+L1092947992L
+L854327284L
+L2222750082L
+L360183510L
+L1312466483L
+L3227531091L
+L2235022500L
+L3013060530L
+L2541091298L
+L3480126342L
+L1839762775L
+L2632608190L
+L1108889403L
+L3045050923L
+L731513126L
+L3505436788L
+L3062762017L
+L1667392680L
+L1354126500L
+L1143573930L
+L2816645702L
+L2100356873L
+L2817679106L
+L1210746010L
+L2409915248L
+L2910119964L
+L2309001420L
+L220351824L
+L3667352871L
+L3993148590L
+L2886160232L
+L4239393701L
+L1189270581L
+L3067985541L
+L147374573L
+L2355164869L
+L3696013550L
+L4227037846L
+L1905112743L
+L3312843689L
+L2930678266L
+L1828795355L
+L76933594L
+L3987100796L
+L1288361435L
+L3464529151L
+L965498079L
+L1444623093L
+L1372893415L
+L1536235597L
+L1341994850L
+L963594758L
+L2115295754L
+L982098685L
+L1053433904L
+L2078469844L
+L3059765792L
+L1753606181L
+L2130171254L
+L567588194L
+L529629426L
+L3621523534L
+L3027576564L
+L1176438083L
+L4096287858L
+L1168574683L
+L1425058962L
+L1429631655L
+L2902106759L
+L761900641L
+L1329183956L
+L1947050932L
+L447490289L
+L3282516276L
+L200037389L
+L921868197L
+L3331403999L
+L4088760249L
+L2188326318L
+L288401961L
+L1360802675L
+L314302808L
+L3314639210L
+L3749821203L
+L2286081570L
+L2768939062L
+L3200541016L
+L2133495482L
+L385029880L
+L4217232202L
+L3171617231L
+L1660846653L
+L2459987621L
+L2691776124L
+L4225030408L
+L3595396773L
+L1103680661L
+L539064057L
+L1492841101L
+L166195394L
+L757973658L
+L533893054L
+L2784879594L
+L1021821883L
+L2350548162L
+L176852116L
+L3503166025L
+L148079914L
+L1633466236L
+L2773090165L
+L1162846701L
+L3575737795L
+L1624178239L
+L2454894710L
+L3014691938L
+L526355679L
+L1870824081L
+L3362425857L
+L3907566665L
+L3462563184L
+L2229112004L
+L4203735748L
+L1557442481L
+L924133999L
+L1906634214L
+L880459727L
+L4065895870L
+L141426254L
+L1258450159L
+L3243115027L
+L1574958840L
+L313939294L
+L3055664260L
+L3459714255L
+L531778790L
+L509505506L
+L1620227491L
+L2675554942L
+L2516509560L
+L3797299887L
+L237135890L
+L3203142213L
+L1087745310L
+L1897151854L
+L3936590041L
+L132765167L
+L2385908063L
+L1360600289L
+L3574567769L
+L2752788114L
+L2644228966L
+L2377705183L
+L601277909L
+L4046480498L
+L324401408L
+L3279931760L
+L2227059377L
+L1538827493L
+L4220532064L
+L478044564L
+L2917117761L
+L635492832L
+L2319763261L
+L795944206L
+L1820473234L
+L1673151409L
+L1404095402L
+L1661067505L
+L3217106938L
+L2406310683L
+L1931309248L
+L2458622868L
+L3323670524L
+L3266852755L
+L240083943L
+L3168387397L
+L607722198L
+L1256837690L
+L3608124913L
+L4244969357L
+L1289959293L
+L519750328L
+L3229482463L
+L1105196988L
+L1832684479L
+L3761037224L
+L2363631822L
+L3297957711L
+L572766355L
+L1195822137L
+L2239207981L
+L2034241203L
+L163540514L
+L288160255L
+L716403680L
+L4019439143L
+L1536281935L
+L2345100458L
+L2786059178L
+L2822232109L
+L987025395L
+L3061166559L
+L490422513L
+L2551030115L
+L2638707620L
+L1344728502L
+L714108911L
+L2831719700L
+L2188615369L
+L373509061L
+L1351077504L
+L3136217056L
+L783521095L
+L2554949468L
+L2662499550L
+L1203826951L
+L1379632388L
+L1918858985L
+L607465976L
+L1980450237L
+L3540079211L
+L3397813410L
+L2913309266L
+L2289572621L
+L4133935327L
+L4166227663L
+L3371801704L
+L3065474909L
+L3580562343L
+L3832172378L
+L2556130719L
+L310473705L
+L3734014346L
+L2490413810L
+L347233056L
+L526668037L
+L1158393656L
+L544329703L
+L2150085419L
+L3914038146L
+L1060237586L
+L4159394837L
+L113205121L
+L309966775L
+L4098784465L
+L3635222960L
+L2417516569L
+L2089579233L
+L1725807541L
+L2728122526L
+L2365836523L
+L2504078522L
+L1443946869L
+L2384171411L
+L997046534L
+L3249131657L
+L1699875986L
+L3618097146L
+L1716038224L
+L2629818607L
+L2929217876L
+L1367250314L
+L1726434951L
+L1388496325L
+L2107602181L
+L2822366842L
+L3052979190L
+L3796798633L
+L1543813381L
+L959000121L
+L1363845999L
+L2952528150L
+L874184932L
+L1888387194L
+L2328695295L
+L3442959855L
+L841805947L
+L1087739275L
+L3230005434L
+L3045399265L
+L1161817318L
+L2898673139L
+L860011094L
+L940539782L
+L1297818080L
+L4243941623L
+L1577613033L
+L4204131887L
+L3819057225L
+L1969439558L
+L3297963932L
+L241874069L
+L3517033453L
+L2295345664L
+L1098911422L
+L886955008L
+L1477397621L
+L4279347332L
+L3616558791L
+L2384411957L
+L742537731L
+L764221540L
+L2871698900L
+L3530636393L
+L691256644L
+L758730966L
+L1717773090L
+L2751856377L
+L3188484000L
+L3767469670L
+L1623863053L
+L3533236793L
+L4099284176L
+L723921107L
+L310594036L
+L223978745L
+L2266565776L
+L201843303L
+L2969968546L
+L3351170888L
+L3465113624L
+L2712246712L
+L1521383057L
+L2384461798L
+L216357551L
+L2167301975L
+L3144653194L
+L2781220155L
+L3620747666L
+L95971265L
+L4255400243L
+L59999757L
+L4174273472L
+L3974511524L
+L1007123950L
+L3112477628L
+L806461512L
+L3148074008L
+L528352882L
+L2545979588L
+L2562281969L
+L3010249477L
+L1886331611L
+L3210656433L
+L1034099976L
+L2906893579L
+L1197048779L
+L1870004401L
+L3898300490L
+L2686856402L
+L3975723478L
+L613043532L
+L2565674353L
+L3760045310L
+L3468984376L
+L4126258L
+L303855424L
+L3988963552L
+L276256796L
+L544071807L
+L1023872062L
+L1747461519L
+L1975571260L
+L4033766958L
+L2946555557L
+L1492957796L
+L958271685L
+L46480515L
+L907760635L
+L1306626357L
+L819652378L
+L1172300279L
+L1116851319L
+L495601075L
+L1157715330L
+L534220108L
+L377320028L
+L1672286106L
+L2066219284L
+L1842386355L
+L2546059464L
+L1839457336L
+L3476194446L
+L3050550028L
+L594705582L
+L1905813535L
+L1813033412L
+L2700858157L
+L169067972L
+L4252889045L
+L1921944555L
+L497671474L
+L210143935L
+L2688398489L
+L325158375L
+L3450846447L
+L891760597L
+L712802536L
+L1132557436L
+L1417044075L
+L1639889660L
+L1746379970L
+L1478741647L
+L2817563486L
+L2573612532L
+L4266444457L
+L2911601615L
+L804745411L
+L2207254652L
+L1189140646L
+L3829725111L
+L3637367348L
+L1944731747L
+L2193440343L
+L1430195413L
+L1173515229L
+L1582618217L
+L2070767037L
+L247908936L
+L1460675439L
+L556001596L
+L327629335L
+L1036133876L
+L4228129605L
+L999174048L
+L3635804039L
+L1416550481L
+L1270540269L
+L4280743815L
+L39607659L
+L1552540623L
+L2762294062L
+L504137289L
+L4117044239L
+L1417130225L
+L1342970056L
+L1755716449L
+L1169447322L
+L2731401356L
+L2319976745L
+L2869221479L
+L23972655L
+L2251495389L
+L1429860878L
+L3728135992L
+L4241432973L
+L3698275076L
+L216416432L
+L4040046960L
+L246077176L
+L894675685L
+L3932282259L
+L3097205100L
+L2128818650L
+L1319010656L
+L1601974009L
+L2552960957L
+L3554016055L
+L4209395641L
+L2013340102L
+L3370447801L
+L2307272002L
+L1795091354L
+L202109401L
+L988345070L
+L2514870758L
+L1132726850L
+L582746224L
+L3112305421L
+L1843020683L
+L3600189223L
+L1101349165L
+L4211905855L
+L2866677581L
+L2881621130L
+L4165324109L
+L4238773191L
+L3635649550L
+L2670481044L
+L2996248219L
+L1676992480L
+L3473067050L
+L4205793699L
+L4019490897L
+L1579990481L
+L1899617990L
+L1136347713L
+L1802842268L
+L3591752960L
+L1197308739L
+L433629786L
+L4032142790L
+L3148041979L
+L3312138845L
+L3896860449L
+L3298182567L
+L907605170L
+L1658664067L
+L2682980313L
+L2523523173L
+L1208722103L
+L3808530363L
+L1079003946L
+L4282402864L
+L2041010073L
+L2667555071L
+L688018180L
+L1405121012L
+L4167994076L
+L3504695336L
+L1923944749L
+L1143598790L
+L3936268898L
+L3606243846L
+L1017420080L
+L4026211169L
+L596529763L
+L1844259624L
+L2840216282L
+L2673807759L
+L3407202575L
+L2737971083L
+L4075423068L
+L3684057432L
+L3146627241L
+L599650513L
+L69773114L
+L1257035919L
+L807485291L
+L2376230687L
+L3036593147L
+L2642411658L
+L106080044L
+L2199622729L
+L291834511L
+L2697611361L
+L11689733L
+L625123952L
+L3226023062L
+L3229663265L
+L753059444L
+L2843610189L
+L624L
+tp2
+Ntp3
+b. \ No newline at end of file
diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py
index dcb768f..e211916 100644
--- a/Lib/test/test_cmd_line_script.py
+++ b/Lib/test/test_cmd_line_script.py
@@ -35,15 +35,15 @@ def temp_dir():
finally:
shutil.rmtree(dirname)
-test_source = ("""\
+test_source = """\
# Script may be run with optimisation enabled, so don't rely on assert
# statements being executed
def assertEqual(lhs, rhs):
if lhs != rhs:
- raise AssertionError("%r != %r" % (lhs, rhs))
+ raise AssertionError('%r != %r' % (lhs, rhs))
def assertIdentical(lhs, rhs):
if lhs is not rhs:
- raise AssertionError("%r is not %r" % (lhs, rhs))
+ raise AssertionError('%r is not %r' % (lhs, rhs))
# Check basic code execution
result = ['Top level assignment']
def f():
@@ -53,17 +53,18 @@ assertEqual(result, ['Top level assignment', 'Lower level reference'])
# Check population of magic variables
assertEqual(__name__, '__main__')
print('__file__==%r' % __file__)
+print('__package__==%r' % __package__)
# Check the sys module
import sys
assertIdentical(globals(), sys.modules[__name__].__dict__)
print('sys.argv[0]==%r' % sys.argv[0])
-""")
+"""
-def _make_test_script(script_dir, script_basename):
- script_filename = script_basename+os.path.extsep+"py"
+def _make_test_script(script_dir, script_basename, source=test_source):
+ script_filename = script_basename+os.path.extsep+'py'
script_name = os.path.join(script_dir, script_filename)
- script_file = open(script_name, "w")
- script_file.write(test_source)
+ script_file = open(script_name, 'w')
+ script_file.write(source)
script_file.close()
return script_name
@@ -88,59 +89,96 @@ def _make_test_zip(zip_dir, zip_basename, script_name):
# zip_file.close()
return zip_name
+def _make_test_pkg(pkg_dir):
+ os.mkdir(pkg_dir)
+ _make_test_script(pkg_dir, '__init__', '')
+
+# There's no easy way to pass the script directory in to get
+# -m to work (avoiding that is the whole point of making
+# directories and zipfiles executable!)
+# So we fake it for testing purposes with a custom launch script
+launch_source = """\
+import sys, os.path, runpy
+sys.path[0:0] = os.path.dirname(__file__)
+runpy._run_module_as_main(%r)
+"""
+
+def _make_launch_script(script_dir, script_basename, module_name):
+ return _make_test_script(script_dir, script_basename,
+ launch_source % module_name)
+
class CmdLineTest(unittest.TestCase):
- def _check_script(self, script_name, expected_file, expected_argv0):
- exit_code, data = _run_python(script_name)
+ def _check_script(self, script_name, expected_file,
+ expected_argv0, expected_package,
+ *cmd_line_switches):
+ run_args = cmd_line_switches + (script_name,)
+ exit_code, data = _run_python(*run_args)
if verbose:
print("Output from test script %r:" % script_name)
print(data)
- self.assertEqual(exit_code, 0, data)
+ self.assertEqual(exit_code, 0)
printed_file = '__file__==%r' % expected_file
printed_argv0 = 'sys.argv[0]==%r' % expected_argv0
- self.assert_(printed_file in data, (printed_file, data))
- self.assert_(printed_argv0 in data, (printed_argv0, data))
+ printed_package = '__package__==%r' % expected_package
+ if verbose:
+ print('Expected output:')
+ print(printed_file)
+ print(printed_package)
+ print(printed_argv0)
+ self.assert_(printed_file in data)
+ self.assert_(printed_package in data)
+ self.assert_(printed_argv0 in data)
def test_basic_script(self):
with temp_dir() as script_dir:
- script_name = _make_test_script(script_dir, "script")
- self._check_script(script_name, script_name, script_name)
+ script_name = _make_test_script(script_dir, 'script')
+ self._check_script(script_name, script_name, script_name, None)
def test_script_compiled(self):
with temp_dir() as script_dir:
- script_name = _make_test_script(script_dir, "script")
+ script_name = _make_test_script(script_dir, 'script')
compiled_name = _compile_test_script(script_name)
os.remove(script_name)
- self._check_script(compiled_name, compiled_name, compiled_name)
+ self._check_script(compiled_name, compiled_name, compiled_name, None)
def test_directory(self):
with temp_dir() as script_dir:
- script_name = _make_test_script(script_dir, "__main__")
- self._check_script(script_dir, script_name, script_dir)
+ script_name = _make_test_script(script_dir, '__main__')
+ self._check_script(script_dir, script_name, script_dir, '')
def test_directory_compiled(self):
with temp_dir() as script_dir:
- script_name = _make_test_script(script_dir, "__main__")
+ script_name = _make_test_script(script_dir, '__main__')
compiled_name = _compile_test_script(script_name)
os.remove(script_name)
- self._check_script(script_dir, compiled_name, script_dir)
+ self._check_script(script_dir, compiled_name, script_dir, '')
def test_zipfile(self):
with temp_dir() as script_dir:
- script_name = _make_test_script(script_dir, "__main__")
- zip_name = _make_test_zip(script_dir, "test_zip", script_name)
- self._check_script(zip_name, None, zip_name)
+ script_name = _make_test_script(script_dir, '__main__')
+ zip_name = _make_test_zip(script_dir, 'test_zip', script_name)
+ self._check_script(zip_name, None, zip_name, '')
def test_zipfile_compiled(self):
with temp_dir() as script_dir:
- script_name = _make_test_script(script_dir, "__main__")
+ script_name = _make_test_script(script_dir, '__main__')
compiled_name = _compile_test_script(script_name)
- zip_name = _make_test_zip(script_dir, "test_zip", compiled_name)
- self._check_script(zip_name, None, zip_name)
+ zip_name = _make_test_zip(script_dir, 'test_zip', compiled_name)
+ self._check_script(zip_name, None, zip_name, '')
+
+ def test_module_in_package(self):
+ with temp_dir() as script_dir:
+ pkg_dir = os.path.join(script_dir, 'test_pkg')
+ _make_test_pkg(pkg_dir)
+ script_name = _make_test_script(pkg_dir, 'script')
+ launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg.script')
+ self._check_script(launch_name, script_name,
+ script_name, 'test_pkg')
def test_main():
test.test_support.run_unittest(CmdLineTest)
test.test_support.reap_children()
-if __name__ == "__main__":
+if __name__ == '__main__':
test_main()
diff --git a/Lib/test/test_frozen.py b/Lib/test/test_frozen.py
index 05e8e8c..99f499d 100644
--- a/Lib/test/test_frozen.py
+++ b/Lib/test/test_frozen.py
@@ -12,7 +12,7 @@ class FrozenTests(unittest.TestCase):
except ImportError as x:
self.fail("import __hello__ failed:" + str(x))
self.assertEqual(__hello__.initialized, True)
- self.assertEqual(len(dir(__hello__)), 5)
+ self.assertEqual(len(dir(__hello__)), 6, dir(__hello__))
try:
import __phello__
@@ -20,17 +20,17 @@ class FrozenTests(unittest.TestCase):
self.fail("import __phello__ failed:" + str(x))
self.assertEqual(__phello__.initialized, True)
if not "__phello__.spam" in sys.modules:
- self.assertEqual(len(dir(__phello__)), 6, dir(__phello__))
- else:
self.assertEqual(len(dir(__phello__)), 7, dir(__phello__))
+ else:
+ self.assertEqual(len(dir(__phello__)), 8, dir(__phello__))
try:
import __phello__.spam
except ImportError as x:
self.fail("import __phello__.spam failed:" + str(x))
self.assertEqual(__phello__.spam.initialized, True)
- self.assertEqual(len(dir(__phello__.spam)), 5)
- self.assertEqual(len(dir(__phello__)), 7)
+ self.assertEqual(len(dir(__phello__.spam)), 6)
+ self.assertEqual(len(dir(__phello__)), 8)
try:
import __phello__.foo
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
index 4710c8c..b6d2ec0 100644
--- a/Lib/test/test_generators.py
+++ b/Lib/test/test_generators.py
@@ -1668,6 +1668,21 @@ And finalization:
exiting
+GeneratorExit is not caught by except Exception:
+
+>>> def f():
+... try: yield
+... except Exception:
+... print('except')
+... finally:
+... print('finally')
+
+>>> g = f()
+>>> next(g)
+>>> del g
+finally
+
+
Now let's try some ill-behaved generators:
>>> def f():
diff --git a/Lib/test/test_pkg.py b/Lib/test/test_pkg.py
index fde99dc..630956d 100644
--- a/Lib/test/test_pkg.py
+++ b/Lib/test/test_pkg.py
@@ -192,11 +192,13 @@ class TestPkg(unittest.TestCase):
import t5
self.assertEqual(fixdir(dir(t5)),
['__doc__', '__file__', '__name__',
- '__path__', 'foo', 'string', 't5'])
+ '__package__', '__path__', 'foo', 'string', 't5'])
self.assertEqual(fixdir(dir(t5.foo)),
- ['__doc__', '__file__', '__name__', 'string'])
+ ['__doc__', '__file__', '__name__', '__package__',
+ 'string'])
self.assertEqual(fixdir(dir(t5.string)),
- ['__doc__', '__file__', '__name__', 'spam'])
+ ['__doc__', '__file__', '__name__','__package__',
+ 'spam'])
def test_6(self):
hier = [
@@ -212,14 +214,14 @@ class TestPkg(unittest.TestCase):
import t6
self.assertEqual(fixdir(dir(t6)),
['__all__', '__doc__', '__file__',
- '__name__', '__path__'])
+ '__name__', '__package__', '__path__'])
s = """
import t6
from t6 import *
self.assertEqual(fixdir(dir(t6)),
['__all__', '__doc__', '__file__',
- '__name__', '__path__', 'eggs',
- 'ham', 'spam'])
+ '__name__', '__package__', '__path__',
+ 'eggs', 'ham', 'spam'])
self.assertEqual(dir(), ['eggs', 'ham', 'self', 'spam', 't6'])
"""
self.run_code(s)
@@ -245,17 +247,19 @@ class TestPkg(unittest.TestCase):
t7, sub, subsub = None, None, None
import t7 as tas
self.assertEqual(fixdir(dir(tas)),
- ['__doc__', '__file__', '__name__', '__path__'])
+ ['__doc__', '__file__', '__name__',
+ '__package__', '__path__'])
self.failIf(t7)
from t7 import sub as subpar
self.assertEqual(fixdir(dir(subpar)),
- ['__doc__', '__file__', '__name__', '__path__'])
+ ['__doc__', '__file__', '__name__',
+ '__package__', '__path__'])
self.failIf(t7)
self.failIf(sub)
from t7.sub import subsub as subsubsub
self.assertEqual(fixdir(dir(subsubsub)),
- ['__doc__', '__file__', '__name__', '__path__',
- 'spam'])
+ ['__doc__', '__file__', '__name__',
+ '__package__', '__path__', 'spam'])
self.failIf(t7)
self.failIf(sub)
self.failIf(subsub)
diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py
index 3023d08..6adcd06 100644
--- a/Lib/test/test_random.py
+++ b/Lib/test/test_random.py
@@ -144,6 +144,19 @@ class TestBasicOps(unittest.TestCase):
restoredseq = [newgen.random() for i in range(10)]
self.assertEqual(origseq, restoredseq)
+ def test_bug_1727780(self):
+ # verify that version-2-pickles can be loaded
+ # fine, whether they are created on 32-bit or 64-bit
+ # platforms, and that version-3-pickles load fine.
+ files = [("randv2_32.pck", 780),
+ ("randv2_64.pck", 866),
+ ("randv3.pck", 343)]
+ for file, value in files:
+ f = open(test_support.findfile(file),"rb")
+ r = pickle.load(f)
+ f.close()
+ self.assertEqual(r.randrange(1000), value)
+
class WichmannHill_TestBasicOps(TestBasicOps):
gen = random.WichmannHill()
diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py
index b003f17..ffa36dc 100644
--- a/Lib/test/test_runpy.py
+++ b/Lib/test/test_runpy.py
@@ -5,7 +5,12 @@ import os.path
import sys
import tempfile
from test.test_support import verbose, run_unittest, forget
-from runpy import _run_code, _run_module_code, _run_module_as_main, run_module
+from runpy import _run_code, _run_module_code, run_module
+
+# Note: This module can't safely test _run_module_as_main as it
+# runs its tests in the current process, which would mess with the
+# real __main__ module (usually test.regrtest)
+# See test_cmd_line_script for a test that executes that code path
# Set up the test code and expected results
@@ -36,6 +41,7 @@ class RunModuleCodeTest(unittest.TestCase):
self.failUnless(d["__name__"] is None)
self.failUnless(d["__file__"] is None)
self.failUnless(d["__loader__"] is None)
+ self.failUnless(d["__package__"] is None)
self.failUnless(d["run_argv0"] is saved_argv0)
self.failUnless("run_name" not in d)
self.failUnless(sys.argv[0] is saved_argv0)
@@ -45,13 +51,15 @@ class RunModuleCodeTest(unittest.TestCase):
name = "<Nonsense>"
file = "Some other nonsense"
loader = "Now you're just being silly"
+ package = '' # Treat as a top level module
d1 = dict(initial=initial)
saved_argv0 = sys.argv[0]
d2 = _run_module_code(self.test_source,
d1,
name,
file,
- loader)
+ loader,
+ package)
self.failUnless("result" not in d1)
self.failUnless(d2["initial"] is initial)
self.assertEqual(d2["result"], self.expected_result)
@@ -62,6 +70,7 @@ class RunModuleCodeTest(unittest.TestCase):
self.failUnless(d2["__file__"] is file)
self.failUnless(d2["run_argv0"] is file)
self.failUnless(d2["__loader__"] is loader)
+ self.failUnless(d2["__package__"] is package)
self.failUnless(sys.argv[0] is saved_argv0)
self.failUnless(name not in sys.modules)
@@ -164,7 +173,7 @@ class RunModuleTest(unittest.TestCase):
self._del_pkg(pkg_dir, depth, mod_name)
if verbose: print("Module executed successfully")
- def _add_relative_modules(self, base_dir, depth):
+ def _add_relative_modules(self, base_dir, source, depth):
if depth <= 1:
raise ValueError("Relative module test needs depth > 1")
pkg_name = "__runpy_pkg__"
@@ -190,7 +199,7 @@ class RunModuleTest(unittest.TestCase):
if verbose: print(" Added nephew module:", nephew_fname)
def _check_relative_imports(self, depth, run_name=None):
- contents = """\
+ contents = r"""\
from __future__ import absolute_import
from . import sibling
from ..uncle.cousin import nephew
@@ -198,16 +207,21 @@ from ..uncle.cousin import nephew
pkg_dir, mod_fname, mod_name = (
self._make_pkg(contents, depth))
try:
- self._add_relative_modules(pkg_dir, depth)
+ self._add_relative_modules(pkg_dir, contents, depth)
+ pkg_name = mod_name.rpartition('.')[0]
if verbose: print("Running from source:", mod_name)
- d1 = run_module(mod_name) # Read from source
+ d1 = run_module(mod_name, run_name=run_name) # Read from source
+ self.failUnless("__package__" in d1)
+ self.failUnless(d1["__package__"] == pkg_name)
self.failUnless("sibling" in d1)
self.failUnless("nephew" in d1)
del d1 # Ensure __loader__ entry doesn't keep file open
__import__(mod_name)
os.remove(mod_fname)
if verbose: print("Running from compiled:", mod_name)
- d2 = run_module(mod_name) # Read from bytecode
+ d2 = run_module(mod_name, run_name=run_name) # Read from bytecode
+ self.failUnless("__package__" in d2)
+ self.failUnless(d2["__package__"] == pkg_name)
self.failUnless("sibling" in d2)
self.failUnless("nephew" in d2)
del d2 # Ensure __loader__ entry doesn't keep file open
@@ -225,6 +239,11 @@ from ..uncle.cousin import nephew
if verbose: print("Testing relative imports at depth:", depth)
self._check_relative_imports(depth)
+ def test_main_relative_import(self):
+ for depth in range(2, 5):
+ if verbose: print("Testing main relative imports at depth:", depth)
+ self._check_relative_imports(depth, "__main__")
+
def test_main():
run_unittest(RunModuleCodeTest)