Ticket #4415: 4415_tests.diff
File 4415_tests.diff, 973 bytes (added by , 17 years ago) |
---|
-
tests/modeltests/model_forms/models.py
70 70 def __unicode__(self): 71 71 return self.phone 72 72 73 class BoundaryModel(models.Model): 74 positive_integer = models.PositiveIntegerField(null=True, blank=True) 75 73 76 __test__ = {'API_TESTS': """ 74 77 >>> from django.newforms import form_for_model, form_for_instance, save_instance, BaseForm, Form, CharField 75 78 >>> import datetime … … 560 563 True 561 564 >>> f.cleaned_data 562 565 {'phone': u'312-555-1212', 'description': u'Assistance'} 566 567 # Boundary conditions / validation ############################################ 568 >>> BoundaryForm = form_for_model(BoundaryModel) 569 >>> f = BoundaryForm({'positive_integer':100}) 570 >>> f.is_valid() 571 True 572 >>> f = BoundaryForm({'positive_integer':-100}) 573 >>> f.is_valid() 574 False