So, when writing unit tests, you would like to test one specific thing. Because when you write more code and the test fails, it will be much easier for you to understand what happened in the unit test. It is possible that with the statements that you have made so far, you test one behavior or functionality of the code, then the statements are in order.
To make an example, you have two functions below list_counter dependent on word_count . Therefore, when testing list_counter you can make two statements to make sure that the two components in list_counter are correct. But it would probably be wiser to test word_count separately.
def word_count(word): return len(word) def list_counter(listing=None): total = 0 for l in listing: total += word_count(l) return (len(listing), total)
It is difficult to comment on your case in more detail, since I do not have access to how the model looks. self.mock_view also appears out of nowhere.
source share