Table of Contents

Class: ICellMapper ./src/peak/ddt/interfaces.py

Provide a uniform getter/setter interface for processing cell data

There are two default implementations of this; one for features of domain model classes, and one for instance methods. Features map get and set to getting or setting the attribute, while methods map "get" to checking the return value of the method called with no argument, and "set" to calling the method with one argument, whose value is provided by the cell.

Base Classes   
protocols.Interface
Methods   
extract
format
get
invoke
parse
set
suggestType
  extract 
extract ( targetInstance )

Return the value of the feature for targetInstance

  format 
format ( targetInstance )

Return extract(targetInstance) as a formatted string

  get 
get ( targetInstance,  cell )

Get data from the targetInstance and compare it to cell

This method should mark the cell right/wrong, perform any necessary annotations, etc.

  invoke 
invoke ( targetInstance,  cell )

Invoke the feature on the targetInstance, with no arguments

If the invocation raises an exception, record it in cell. If the feature does not support invocation, record an error in cell.

  parse 
parse ( cell )

Interpret cell.text according to datatype, and return the value

If an error occurs, mark the cell with an exception, and return None.

  set 
set ( targetInstance,  cell )

Pass data from cell to targetInstance

In general, this method shouldn't do anything to the cell, except perhaps to record an exception if there is a problem passing the data.

  suggestType 
suggestType ( dataType )

Suggest the model.IType to be used for parsing/formatting cells

If a cell mapper already knows the correct data type, it may ignore the type supplied by this method. If a cell mapper does not know what type to use, it should default to model.String unless this method is called.


Table of Contents

This document was automatically generated on Mon Feb 17 01:11:05 2025 by HappyDoc version 2.1