I think it would be cleaner to just pass in the variables that you need from testvars, as opposed to the whole testvars dict. Then this object would not have to understand the structure of testvars and would be insulated from any changes to said structure.