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 your proposal, as the data locations > > (i.e., self.cleaned_data) can be implied. > > I'm not sure I understand this. Are you proposing putting some methods > into newforms.forms.BaseForm that only exist for supporting the test > framework? I'm usually not in favour of that type of change because it's > leaking stuff from the test framework, which is ideally entirely > independent of core functionality, into the core.
No - this has nothing to do with the test framework. It's a set of helper functions to support writing clean_XXX methods. The connection with the test system is purely conceptual. The functional requirements of form validation are quite similar to those during a test: assert that two values are/are not equal, assert that an exception is/isn't raised when a query is executed, etc. However, whereas the test system checks arbitrary test values and raises an AssertionError, the validation system needs to check the contents of cleaned_data and raise a ValidationError. The reason for putting the methods in BaseForm is that they have very little use outside of a clean_XXX method. The reason for calling them assertEquals rather than assert_equals is that the parallels with the test system are quite strong. Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---
