Source

savReaderWriter / savReaderWriter / doc_tests / test_SavReader_rawMode.txt

Full commit
##############################################################################
## Read a file and iterate over its records (rawMode)
##############################################################################

>>> import sys
>>> sys.stdout.write('<skipline> '); from savReaderWriter import * # doctest: +ELLIPSIS
<skipline> ...

## ----- Typical use
## rawMode means date and certain values are not converted/formatted
## Dates are now shown as the number of seconds since the Gregorian epoch
>>> savFileName = "../savReaderWriter/test_data/Employee data.sav"
>>> with SavReader(savFileName, rawMode=True) as sav: # doctest: +ELLIPSIS
...     for lino, line in enumerate(sav):
...         if lino < 100:
...             print line
...
[1.0, 'm       ', 11654150400.0, 15.0, 3.0, 57000.0, 27000.0, 98.0, 144.0, 0.0]
[2.0, 'm       ', 11852956800.0, 16.0, 1.0, 40200.0, 18750.0, 98.0, 36.0, 0.0]
[3.0, 'f       ', 10943337600.0, 12.0, 1.0, 21450.0, 12000.0, 98.0, 381.0, 0.0]
[4.0, 'f       ', 11502518400.0, 8.0, 1.0, 21900.0, 13200.0, 98.0, 190.0, 0.0]
[5.0, 'm       ', 11749363200.0, 15.0, 1.0, 45000.0, 21000.0, 98.0, 138.0, 0.0]
[6.0, 'm       ', 11860819200.0, 15.0, 1.0, 32100.0, 13500.0, 98.0, 67.0, 0.0]
[7.0, 'm       ', 11787552000.0, 15.0, 1.0, 36000.0, 18750.0, 98.0, 114.0, 0.0]
[8.0, 'f       ', 12103948800.0, 12.0, 1.0, 21900.0, 9750.0, 98.0, 0.0, 0.0]
[9.0, 'f       ', 11463897600.0, 15.0, 1.0, 27900.0, 12750.0, 98.0, 115.0, 0.0]
[10.0, 'f       ', 11465712000.0, 12.0, 1.0, 24000.0, 13500.0, 98.0, 244.0, 0.0]
[11.0, 'f       ', 11591424000.0, 16.0, 1.0, 30300.0, 16500.0, 98.0, 143.0, 0.0]
[12.0, 'm       ', 12094012800.0, 8.0, 1.0, 28350.0, 12000.0, 98.0, 26.0, 1.0]
[13.0, 'm       ', 11920867200.0, 15.0, 1.0, 27750.0, 14250.0, 98.0, 34.0, 1.0]
[14.0, 'f       ', 11561529600.0, 15.0, 1.0, 35100.0, 16800.0, 98.0, 137.0, 1.0]
[15.0, 'm       ', 11987654400.0, 12.0, 1.0, 27300.0, 13500.0, 97.0, 66.0, 0.0]
[16.0, 'm       ', 12057724800.0, 12.0, 1.0, 40800.0, 15000.0, 97.0, 24.0, 0.0]
[17.0, 'm       ', 11984025600.0, 15.0, 1.0, 46000.0, 14250.0, 97.0, 48.0, 0.0]
[18.0, 'm       ', 11784355200.0, 16.0, 3.0, 103750.0, 27510.0, 97.0, 70.0, 0.0]
[19.0, 'm       ', 11986790400.0, 12.0, 1.0, 42300.0, 14250.0, 97.0, 103.0, 0.0]
[20.0, 'f       ', 11274508800.0, 12.0, 1.0, 26250.0, 11550.0, 97.0, 48.0, 0.0]
[21.0, 'f       ', 12002688000.0, 16.0, 1.0, 38850.0, 15000.0, 97.0, 17.0, 0.0]
[22.0, 'm       ', 11295676800.0, 12.0, 1.0, 21750.0, 12750.0, 97.0, 315.0, 1.0]
[23.0, 'f       ', 12067920000.0, 15.0, 1.0, 24000.0, 11100.0, 97.0, 75.0, 1.0]
[24.0, 'f       ', 11059113600.0, 12.0, 1.0, 16950.0, 9000.0, 97.0, 124.0, 1.0]
[25.0, 'f       ', 11351404800.0, 15.0, 1.0, 21150.0, 9000.0, 97.0, 171.0, 1.0]
[26.0, 'm       ', 12120019200.0, 15.0, 1.0, 31050.0, 12600.0, 96.0, 14.0, 0.0]
[27.0, 'm       ', 11721110400.0, 19.0, 3.0, 60375.0, 27480.0, 96.0, 96.0, 0.0]
[28.0, 'm       ', 12007094400.0, 15.0, 1.0, 32550.0, 14250.0, 96.0, 43.0, 0.0]
[29.0, 'm       ', 11401171200.0, 19.0, 3.0, 135000.0, 79980.0, 96.0, 199.0, 0.0]
[30.0, 'm       ', 11957760000.0, 15.0, 1.0, 31200.0, 14250.0, 96.0, 54.0, 0.0]
[31.0, 'm       ', 12034656000.0, 12.0, 1.0, 36150.0, 14250.0, 96.0, 83.0, 0.0]
[32.0, 'm       ', 11716790400.0, 19.0, 3.0, 110625.0, 45000.0, 96.0, 120.0, 0.0]
[33.0, 'm       ', 11941948800.0, 15.0, 1.0, 42000.0, 15000.0, 96.0, 68.0, 0.0]
[34.0, 'm       ', 11559456000.0, 19.0, 3.0, 92000.0, 39990.0, 96.0, 175.0, 0.0]
[35.0, 'm       ', 11955513600.0, 17.0, 3.0, 81250.0, 30000.0, 96.0, 18.0, 0.0]
[36.0, 'f       ', 12017289600.0, 8.0, 1.0, 31350.0, 11250.0, 96.0, 52.0, 0.0]
[37.0, 'm       ', 11738736000.0, 12.0, 1.0, 29100.0, 13500.0, 96.0, 113.0, 1.0]
[38.0, 'm       ', 11976940800.0, 15.0, 1.0, 31350.0, 15000.0, 96.0, 49.0, 1.0]
[39.0, 'm       ', 11918707200.0, 16.0, 1.0, 36000.0, 15000.0, 96.0, 46.0, 1.0]
[40.0, 'f       ', 11072419200.0, 15.0, 1.0, 19200.0, 9000.0, 96.0, 23.0, 1.0]
[41.0, 'f       ', 11941948800.0, 12.0, 1.0, 23550.0, 11550.0, 96.0, 52.0, 1.0]
[42.0, 'm       ', 11926742400.0, 15.0, 1.0, 35100.0, 16500.0, 95.0, 90.0, 0.0]
[43.0, 'm       ', 12031459200.0, 12.0, 1.0, 23250.0, 14250.0, 95.0, 46.0, 0.0]
[44.0, 'm       ', 12012710400.0, 8.0, 1.0, 29250.0, 14250.0, 95.0, 50.0, 0.0]
[45.0, 'm       ', 11227939200.0, 12.0, 2.0, 30750.0, 13500.0, 95.0, 307.0, 0.0]
[46.0, 'f       ', 11300428800.0, 15.0, 1.0, 22350.0, 12750.0, 95.0, 165.0, 0.0]
[47.0, 'f       ', 11219644800.0, 12.0, 1.0, 30000.0, 16500.0, 95.0, 228.0, 0.0]
[48.0, 'm       ', 11507097600.0, 12.0, 2.0, 30750.0, 14100.0, 94.0, 240.0, 0.0]
[49.0, 'm       ', 11862979200.0, 15.0, 1.0, 34800.0, 16500.0, 94.0, 93.0, 0.0]
[50.0, 'm       ', 11907129600.0, 16.0, 3.0, 60000.0, 23730.0, 94.0, 59.0, 0.0]
[51.0, 'm       ', 11983161600.0, 12.0, 1.0, 35550.0, 15000.0, 94.0, 48.0, 0.0]
[52.0, 'm       ', 12025670400.0, 15.0, 1.0, 45150.0, 15000.0, 94.0, 40.0, 0.0]
[53.0, 'm       ', 11723961600.0, 18.0, 3.0, 73750.0, 26250.0, 94.0, 56.0, 0.0]
[54.0, 'm       ', 11001916800.0, 12.0, 1.0, 25050.0, 13500.0, 94.0, 444.0, 0.0]
[55.0, 'm       ', 11918966400.0, 12.0, 1.0, 27000.0, 15000.0, 94.0, 120.0, 0.0]
[56.0, 'm       ', 11975990400.0, 15.0, 1.0, 26850.0, 13500.0, 94.0, 5.0, 0.0]
[57.0, 'm       ', 12007440000.0, 15.0, 1.0, 33900.0, 15750.0, 94.0, 78.0, 0.0]
[58.0, 'f       ', 12057465600.0, 15.0, 1.0, 26400.0, 13500.0, 94.0, 3.0, 0.0]
[59.0, 'm       ', 11946268800.0, 15.0, 1.0, 28050.0, 14250.0, 94.0, 36.0, 1.0]
[60.0, 'm       ', 11876198400.0, 12.0, 1.0, 30900.0, 15000.0, 94.0, 102.0, 1.0]
[61.0, 'm       ', 12040185600.0, 8.0, 1.0, 22500.0, 9750.0, 94.0, 36.0, 1.0]
[62.0, 'm       ', 11984025600.0, 16.0, 3.0, 48000.0, 21750.0, 93.0, 22.0, 0.0]
[63.0, 'm       ', 11955340800.0, 17.0, 3.0, 55000.0, 26250.0, 93.0, 32.0, 0.0]
[64.0, 'm       ', 12021782400.0, 16.0, 3.0, 53125.0, 21000.0, 93.0, 48.0, 0.0]
[65.0, 'm       ', 12037507200.0, 8.0, 1.0, 21900.0, 14550.0, 93.0, 41.0, 0.0]
[66.0, 'm       ', 11970892800.0, 19.0, 3.0, 78125.0, 30000.0, 93.0, 7.0, 0.0]
[67.0, 'm       ', 12042777600.0, 16.0, 3.0, 46000.0, 21240.0, 93.0, 35.0, 0.0]
[68.0, 'm       ', 12009168000.0, 16.0, 3.0, 45250.0, 21480.0, 93.0, 36.0, 0.0]
[69.0, 'm       ', 11918793600.0, 16.0, 3.0, 56550.0, 25000.0, 93.0, 34.0, 0.0]
[70.0, 'm       ', 11970201600.0, 15.0, 1.0, 41100.0, 20250.0, 93.0, 27.0, 0.0]
[71.0, 'm       ', 11545632000.0, 17.0, 3.0, 82500.0, 34980.0, 93.0, 207.0, 0.0]
[72.0, 'f       ', 12030508800.0, 16.0, 1.0, 54000.0, 18000.0, 93.0, 11.0, 0.0]
[73.0, 'f       ', 12159590400.0, 12.0, 1.0, 26400.0, 10500.0, 93.0, 0.0, 0.0]
[74.0, 'f       ', 11061878400.0, 15.0, 1.0, 33900.0, 19500.0, 93.0, 192.0, 0.0]
[75.0, 'f       ', 12080880000.0, 15.0, 1.0, 24150.0, 11550.0, 93.0, 0.0, 0.0]
[76.0, 'f       ', 12145852800.0, 15.0, 1.0, 29250.0, 11550.0, 93.0, 11.0, 0.0]
[77.0, 'f       ', 12177993600.0, 12.0, 1.0, 27600.0, 11400.0, 93.0, 6.0, 0.0]
[78.0, 'f       ', 12176265600.0, 12.0, 1.0, 22950.0, 10500.0, 93.0, 10.0, 0.0]
[79.0, 'f       ', 11968819200.0, 16.0, 1.0, 34800.0, 14550.0, 93.0, 8.0, 0.0]
[80.0, 'f       ', 11947824000.0, 16.0, 1.0, 51000.0, 18000.0, 93.0, 22.0, 0.0]
[81.0, 'f       ', 12162355200.0, 12.0, 1.0, 24300.0, 10950.0, 93.0, 5.0, 0.0]
[82.0, 'f       ', 11514182400.0, 12.0, 1.0, 24750.0, 14250.0, 93.0, 193.0, 1.0]
[83.0, 'f       ', 12149222400.0, 12.0, 1.0, 22950.0, 11250.0, 93.0, 0.0, 1.0]
[84.0, 'f       ', 12130732800.0, 8.0, 1.0, 25050.0, 10950.0, 93.0, 8.0, 1.0]
[85.0, 'm       ', 11975385600.0, 15.0, 1.0, 25950.0, 17100.0, 92.0, 42.0, 0.0]
[86.0, 'm       ', 11955772800.0, 15.0, 1.0, 31650.0, 15750.0, 92.0, 64.0, 0.0]
[87.0, 'm       ', 11897452800.0, 12.0, 1.0, 24150.0, 14100.0, 92.0, 130.0, 0.0]
[88.0, 'm       ', 11970374400.0, 19.0, 3.0, 72500.0, 28740.0, 92.0, 10.0, 0.0]
[89.0, 'm       ', 11950416000.0, 19.0, 3.0, 68750.0, 27480.0, 92.0, 8.0, 0.0]
[90.0, 'f       ', 11214460800.0, 8.0, 1.0, 16200.0, 9750.0, 92.0, 0.0, 0.0]
[91.0, 'f       ', 12151209600.0, 12.0, 1.0, 20100.0, 11250.0, 92.0, 24.0, 0.0]
[92.0, 'f       ', 12171427200.0, 8.0, 1.0, 24000.0, 10950.0, 92.0, 6.0, 0.0]
[93.0, 'f       ', 12161750400.0, 12.0, 1.0, 25950.0, 10950.0, 92.0, 0.0, 0.0]
[94.0, 'f       ', 11606803200.0, 12.0, 1.0, 24600.0, 10050.0, 92.0, 44.0, 0.0]
[95.0, 'f       ', 12175228800.0, 12.0, 1.0, 28500.0, 10500.0, 92.0, 6.0, 0.0]
[96.0, 'm       ', 11075443200.0, 8.0, 2.0, 30750.0, 15000.0, 92.0, 432.0, 1.0]
[97.0, 'm       ', 11684390400.0, 17.0, 1.0, 40200.0, 19500.0, 92.0, 168.0, 1.0]
[98.0, 'm       ', 11789366400.0, 8.0, 2.0, 30000.0, 15000.0, 92.0, 144.0, 1.0]
[99.0, 'f       ', 12172464000.0, 12.0, 1.0, 22050.0, 10950.0, 92.0, 5.0, 1.0]
[100.0, 'm       ', 12024115200.0, 18.0, 3.0, 78250.0, 27480.0, 91.0, 47.0, 0.0]