lundi 25 novembre 2019

Should I write a setter to access class variable for testing?

I have request_ticker_data method that uses input ticker string to request data through Yahoo Finance. It appends the ticker to class variable self.invalid list if the data could not be accessed. I also have a reset_invalid method that resets invalid to an empty list.

I want to write a unit test for reset_invalid but not sure whether I should assign to self.invalid directly or write a setter method just for the purpose of testing.

Aucun commentaire:

Enregistrer un commentaire