def test_get_solutions(self): """ Ensure Writer.get_solutions returns a list pertaining to the provided problem number """ testWriter = Writer() testWriter._solutions = { 1 : ['sol1', 'sol2', 'sol3'], 2 : ['sol4', 'sol5', 'sol6'], 3 : ['sol7', 'sol8', 'sol9'] } # Ensure correct list is returned self.assertEquals(testWriter.get_solutions(2), ['sol4', 'sol5', 'sol6']) # Ensure invalid number returns an empty list self.assertEquals(testWriter.get_solutions(5), [])
def test_get_all_solutions(self): """ Ensure Writer.get_all_solutions returns a list of all solutions """ testWriter = Writer() # Ensure with no solutions an empty list is returned self.assertEquals(testWriter.get_all_solutions(), []) testWriter._solutions = { 1 : ['sol1', 'sol2', 'sol3'], 2 : ['sol4', 'sol5', 'sol6'], 3 : ['sol7', 'sol8', 'sol9'] } # Ensure all solutions are provided self.assertEquals(testWriter.get_all_solutions(), ['sol1', 'sol2', 'sol3', 'sol4', 'sol5', 'sol6', 'sol7', 'sol8', 'sol9'])