def test_eratosthenes_exception_30(self): upper_bound = 30 expected = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29] self.assertEqual(expected, eratosthenes(upper_bound))
def test_eratosthenes_exception_2(self): upper_bound = 2 expected = [2] self.assertEqual(expected, eratosthenes(upper_bound))
def test_invalid_arguments(self, mock_stdout): expected_output = 'The given upperbound was not an int!\n' eratosthenes('a') self.assertEqual(mock_stdout.getvalue(), expected_output)
def test_eratosthenes(self): self.assertEqual(eratosthenes(30), [2, 3, 5, 7, 11, 13, 17, 19, 23, 29])
def test_empty_return(self): self.assertEqual(eratosthenes(1), [])