Changeset 4912


Ignore:
Timestamp:
27 Jan 2010, 21:12:02 (15 years ago)
Author:
uli
Message:

Extend tests to check for pending files with multiple ignored columns.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/trunk/src/waeup/utils/batching.txt

    r4903 r4912  
    337337    >>> shutil.rmtree(os.path.dirname(result[2]))
    338338
     339
     340We can also tell to ignore some cols from input by passing
     341``--IGNORE--`` as col name:
     342
     343    >>> result = processor.doImport('newcomers.csv', ['name',
     344    ...                             '--IGNORE--', '--IGNORE--'],
     345    ...                    mode='update', user='Bob')
     346    >>> result
     347    (4, 0, '...', None)
     348
     349Clean up:
     350
     351    >>> shutil.rmtree(os.path.dirname(result[2]))
     352
     353If something goes wrong during processing, the respective --IGNORE--
     354cols will be populated correctly in the resulting pending file:
     355
     356    >>> result = processor.doImport('newcomers.csv', ['name', 'dinoports',
     357    ...                             '--IGNORE--', '--IGNORE--'],
     358    ...                    mode='create', user='Bob')
     359    >>> result
     360    (4, 4, '...', '...')
     361
     362    >>> print open(result[3], 'rb').read()
     363    --IGNORE--,name,--IGNORE--,dinoports,--ERRORS--
     364    Barney,Barneys Home,1,2,This object already exists. Skipping.
     365    Wilma,Wilmas Asylum,1,1,This object already exists. Skipping.
     366    Fred,Freds Dinoburgers,0,10,This object already exists. Skipping.
     367    Joey,Joeys Drive-in,0,110,This object already exists. Skipping.
     368
     369The first ignored column ('owner') provides different contents than
     370the second one ('taxpayer').
     371
     372Clean up:
     373
     374    >>> shutil.rmtree(os.path.dirname(result[2]))
     375
     376
     377
     378
    339379Updating entries
    340380----------------
Note: See TracChangeset for help on using the changeset viewer.