Ignore:
Timestamp:
25 Jun 2009, 13:23:30 (15 years ago)
Author:
uli
Message:

Fix tests to get better coverage.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/csvfile/README.txt

    r4339 r4360  
    134134     >>> toBool('TRUE')
    135135     True
     136
     137     >>> toBool('no')
     138     False
    136139
    137140   If we pass in a boolean then this will be returned unchanged:
     
    335338    ... """)
    336339
     340We create a wrapper that requires 'col1' and 'col2' but does not check
     341in constructor, whether this requirement is met:
     342
     343    >>> from waeup.csvfile.interfaces import ICSVFile
     344    >>> from waeup.csvfile import CSVFile
     345    >>> class ICSVFile13(ICSVFile):
     346    ...   """A CSV file that contains a 'special_col' column.
     347    ...   """
     348
     349    >>> class CSVFile13(CSVFile):
     350    ...   required_fields = ['col1', 'col2']
     351    ...   grok.context(basestring)
     352    ...   grok.implements(ICSVFile13)
     353    ...   grok.provides(ICSVFile13)
     354    ...   def __init__(self, context):
     355    ...     self.path = context
     356
     357    >>> grok.testing.grok_component('CSVFile13',  CSVFile13)
     358    True
     359
     360.. warn:: This is bad design as :class:`ICSVFile` instances should
     361          always raise an exception in their constructor if a file
     362          does not meet the basic requirements.
     363
     364          The base constructor will check for the correct values. So,
     365          if you do not overwrite the base constructor, instances will
     366          check on creation time, whether they can handle the desired
     367          file.
     368
     369
    337370We create a wrapper that requires 'col1' and 'col2':
    338371
     
    352385    True
    353386
     387Now the rules applied to all wrappers are:
    354388
    355389* If no instance of a certain wrapper can be created from the given
Note: See TracChangeset for help on using the changeset viewer.