Hey Parth, > I'm currently using a python shell to create objects and then check manually > its attributes, etc.
More or less, do the same thing, but in a test case. 🙂 # Declare class # Create instance # self.assertEqual()/assertIs()/etc expected attributes. # … same but for behaviour too. (Give it some data, is_valid(), etc) Look in tests/forms_tests/tests/test_formsets/py::FormsFormsetTestCase. There are cases there using formset_factory(). Your versions will just declare the FormSet instead. Hope that helps. If you have difficulties, open a PR with what you’ve got: it may be easier to help you there. Kind Regards, Carlton > On 15 Jun 2019, at 07:04, PARTH PATIL <[email protected]> wrote: > > I'm currently working on ticket #10403 > <https://code.djangoproject.com/ticket/10403> -- Declarative syntax for > Formsets > > How to test whether a formset instance is correctly initialized?? > > The thing which I'm trying to achieve is to initiate a formset without using > formset_factory(). I'm able to create objects of class derived from the > BaseFormSet, but its really difficult for me to check whether it is properly > initiated or not as expected from a formset instance. > > Should I write tests for this?? > And if yes, which all parameter values should I assert in the test to > conclude that my formset instance is indistinguishable from the one created > using formset_factory. > > Also is there any better way to test this? I'm currently using a python shell > to create objects and then check manually its attributes, etc. which I know > is not a good way. > > -- > You received this message because you are subscribed to the Google Groups > "Django developers (Contributions to Django itself)" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at https://groups.google.com/group/django-developers > <https://groups.google.com/group/django-developers>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/583effcf-041e-4d30-9693-62a8f9559901%40googlegroups.com > > <https://groups.google.com/d/msgid/django-developers/583effcf-041e-4d30-9693-62a8f9559901%40googlegroups.com?utm_medium=email&utm_source=footer>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/9EE0DD77-54A3-4E41-8175-ACD275C5E0A4%40gmail.com. For more options, visit https://groups.google.com/d/optout.
