Mercurial > hg > numerics
changeset 23:87615a38190c
more stubbing
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Fri, 03 Oct 2014 17:59:28 -0700 |
parents | 61ef3985ec5b |
children | f42808450199 |
files | numerics/data.py |
diffstat | 1 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/numerics/data.py Fri Oct 03 17:48:39 2014 -0700 +++ b/numerics/data.py Fri Oct 03 17:59:28 2014 -0700 @@ -16,7 +16,14 @@ def __init__(self, given, expected): self.given = given self.expected = expected - Exception.__init__(self.__doc__.format(**self.__dict__)) + Exception.__init__(self.__doc__.format(**self.__dict__).strip()) + + +class ColumnLengthException(ColumnNumberException): + """ + wrong length of column: {given} given; {expected} expected + """ + # XXX should share ABC, not inherit from ColumnNumberException class Rows(object): @@ -56,3 +63,11 @@ def __init__(self, *columns): self.columns = OrderedDict() # this should be ordered + for name, values in columns: + self += (name, values) + + def __iadd__(self, item): + column_name, values = item + assert column_name not in self.columns + + return self