# HG changeset patch # User Jeff Hammel # Date 1412384368 25200 # Node ID 87615a38190c7cf702826217be24c445ec914b70 # Parent 61ef3985ec5b908128767b8110110b20840b60bb more stubbing diff -r 61ef3985ec5b -r 87615a38190c numerics/data.py --- 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