How to fetch a field class from a specific form in Django?

I believe there’s a simple method for that…

Wrapping in type() function seems to work. It gives me a class object which is what I need in the fieldclass argument in SimpleTestCase.assertFieldOutput() .

>>> type(f.fields['username'])
<class 'django.contrib.auth.forms.UsernameField'>

The test runs with no errors and produces valid output.