From: Philippe N. <sw...@fr...> - 2004-04-06 08:39:15
|
Ian Bicking wrote: > Looks okay. I'd like to have tests to go with any new code, though. > If tests/test.py is too hairy for you, a test in the form of an > interactive script will do. > Ok, I'll have a look to the tests stuff > Also, it occurs to me that these are all about accumulation -- count, > sum, max, min, and no doubt others. It might be nice to generalize > this, like SelectResult.accumulate(expression), where sum looks like: > > def sum(self, column): > return self.accumulate(sqlbuilder.func.SUM(column)) > > ... though sum should probably also for a string column; accumulate > doesn't have to check for that -- though if it is passed a string it > should interpret it as a SQL expression, so you could do > selectResult.accumulate('SUM(a_column)') > Yes this is a good idea. I was thinking about it when copying count() to make sum() (the code is quite the same) I'll produce a new patch (with tests ;) this evening phil |