I understand that values of virtual docfields are calculated when a document is presented. If I want to verify that the values computed by virtual docfields are correct in a unit test, how would I be able to do this?
I think I found out the solution to this by calling the get_valid_dict()
method of the Document object and then assert the values of virtual doc fields from the returned dict
. Although, there is an as_dict
method too, which appears to call get_valid_dict()
method. Which of the two is the right method to use?