This question is more related to Python than related to Django. I want to test a test record for this function, which I use to dynamically get a Django form with the fields I set.
def quiz_form_factory(question): properties = { 'question': forms.IntegerField(widget=forms.HiddenInput, initial=question.id), 'answers': forms.ModelChoiceField(queryset=question.answers_set) } return type('QuizForm', (forms.Form,), properties)
I want to check if the QuizForm class returns inherited from forms.Form.
Something like:
self.assertTrue(QuizForm isinheritedfrom forms.Form) # I know this does not exist
Is there any way to do this?
python unit-testing
Renne Rocha Apr 11 2018-11-11T00: 00Z
source share