Re: proposal: helper functions for validation

2007-09-11 Thread Marty Alchin
On 9/11/07, Amit Upadhyay <[EMAIL PROTECTED]> wrote: > > About validate_exception, this is the signature of the corresponding > method in unittest: > > *assertRaises*( exception, callable, *args, **kw) > they have removed message, but since args and kw will be passed to > callable, these are the on

Re: proposal: helper functions for validation

2007-09-11 Thread Amit Upadhyay
On 9/11/07, Marty Alchin <[EMAIL PROTECTED]> wrote: > That said, I'd also recommend that if you're going to draw any > parallels with unittest assertions, you should probably do it > reliably. Your validate_exception() example was completely unreadable > to me, because it works quite differently t

Re: proposal: helper functions for validation

2007-09-11 Thread Marty Alchin
I'll chime in just for a few cents here. First, I think it's worth noting that most Python programmers find little value in how many characters they have to type. Sure, Python is generally less verbose than many other languages, but only to the extent of making it more readable. So kep readabilit

Re: proposal: helper functions for validation

2007-09-11 Thread Amit Upadhyay
On 9/11/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > Well... no. assertEquals exists in Python unittests because > assertEquals exists in JUnit, and unittest emulates the JUnit API. > This API is, in turn, based on xUnit, which was derived from SUnit, > the original Smalltalk implementati

Re: proposal: helper functions for validation

2007-09-11 Thread Russell Keith-Magee
On 9/11/07, Amit Upadhyay <[EMAIL PROTECTED]> wrote: > On 9/11/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > I'm afraid you're going to have a hard time convincing me that this is > > a good idea. I'm willing to entertain the idea of validation helpers > > if they genuinely add clarity -

Re: proposal: helper functions for validation

2007-09-11 Thread Amit Upadhyay
On 9/11/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > I'm afraid you're going to have a hard time convincing me that this is > a good idea. I'm willing to entertain the idea of validation helpers > if they genuinely add clarity - but not if they are just a verbose > replacement for somethi

Re: proposal: helper functions for validation

2007-09-10 Thread Russell Keith-Magee
On 9/11/07, Amit Upadhyay <[EMAIL PROTECTED]> wrote: > On 9/10/07, Nis Jørgensen <[EMAIL PROTECTED]> wrote: > > > I don't like the transformation of strings into field values. How would > > you compare a field value to a string? > > Exactly my reason for not making it a method of BaseForm. If thin

Re: proposal: helper functions for validation

2007-09-10 Thread Amit Upadhyay
On 9/10/07, Nis Jørgensen <[EMAIL PROTECTED]> wrote: > > Russell Keith-Magee skrev: > > On 9/9/07, Amit Upadhyay <[EMAIL PROTECTED]> wrote: > > > >> Python unittest TestCase objects have a lot of helper functions like > >> assert_(), failUnless(), assertEqual(), assertNotEqual() and so on[1]. > If

Re: proposal: helper functions for validation

2007-09-10 Thread Nis Jørgensen
Russell Keith-Magee skrev: > On 9/9/07, Amit Upadhyay <[EMAIL PROTECTED]> wrote: > >> Python unittest TestCase objects have a lot of helper functions like >> assert_(), failUnless(), assertEqual(), assertNotEqual() and so on[1]. If we >> had a similar set of helper functions, possibly with more

Re: proposal: helper functions for validation

2007-09-09 Thread Honza Král
On 9/9/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > On 9/9/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > > On Sun, 2007-09-09 at 21:46 +0800, Russell Keith-Magee wrote: > > > No - this has nothing to do with the test framework. It's a set of > > > helper functions to support wri

Re: proposal: helper functions for validation

2007-09-09 Thread Russell Keith-Magee
On 9/9/07, Amit Upadhyay <[EMAIL PROTECTED]> wrote: > Drawback if most of the times we are not using that feature, each validation > statement will have to contain a superfluous self. in the beginning. Whereas > helper functions can all be imported in the name space. Its only minor > syntactic sug

Re: proposal: helper functions for validation

2007-09-09 Thread Russell Keith-Magee
On 9/9/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > On Sun, 2007-09-09 at 21:46 +0800, Russell Keith-Magee wrote: > > No - this has nothing to do with the test framework. It's a set of > > helper functions to support writing clean_XXX methods. > > Okay. Then I'm mostly in agreement, excep

Re: proposal: helper functions for validation

2007-09-09 Thread dummy
Hi, since your assert-function won't be like assert in python or UnitTests, you mix semantics nobody knows everywhere else. Please remember that assert Statements have special meanings depending on __DEBUG__ http://docs.python.org/ref/assert.html http://pyunit.sourceforge.net/pyunit.html#TESTC

Re: proposal: helper functions for validation

2007-09-09 Thread Malcolm Tredinnick
On Sun, 2007-09-09 at 21:46 +0800, Russell Keith-Magee wrote: > On 9/9/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > > On Sun, 2007-09-09 at 15:58 +0800, Russell Keith-Magee wrote: > > [...] > > > - I'm also inclined to continue the similarities, and make the > > > assertion functions me

Re: proposal: helper functions for validation

2007-09-09 Thread Russell Keith-Magee
On 9/9/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > On Sun, 2007-09-09 at 15:58 +0800, Russell Keith-Magee wrote: > [...] > > - I'm also inclined to continue the similarities, and make the > > assertion functions members on BaseForm. This would allow a > > significant simplification of yo

Re: proposal: helper functions for validation

2007-09-09 Thread Amit Upadhyay
On 9/9/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > On Sun, 2007-09-09 at 15:58 +0800, Russell Keith-Magee wrote: > [...] > > - I'm also inclined to continue the similarities, and make the > > assertion functions members on BaseForm. This would allow a > > significant simplification of y

Re: proposal: helper functions for validation

2007-09-09 Thread Malcolm Tredinnick
On Sun, 2007-09-09 at 15:58 +0800, Russell Keith-Magee wrote: [...] > - I'm also inclined to continue the similarities, and make the > assertion functions members on BaseForm. This would allow a > significant simplification of your proposal, as the data locations > (i.e., self.cleaned_data) can be

Re: proposal: helper functions for validation

2007-09-09 Thread Russell Keith-Magee
On 9/9/07, Amit Upadhyay <[EMAIL PROTECTED]> wrote: > Python unittest TestCase objects have a lot of helper functions like > assert_(), failUnless(), assertEqual(), assertNotEqual() and so on[1]. If we > had a similar set of helper functions, possibly with more pythonic names, > newform validation

proposal: helper functions for validation

2007-09-08 Thread Amit Upadhyay
Python unittest TestCase objects have a lot of helper functions like assert_(), failUnless(), assertEqual(), assertNotEqual() and so on[1]. If we had a similar set of helper functions, possibly with more pythonic names, newform validation functions could be written a little more succinctly. de