def test_primes_in_2_to_200(self): low, high = 2, 200 expected_output = self.get_expected_string(low, high) with patch('sys.stdout', new=StringIO()) as fake_out: primes_between(low, high) self.assertEqual(fake_out.getvalue().strip(), expected_output)
def test_zero_prime_in_range_above_2(self): low, high = 24, 29 expected_output = self.get_expected_string(low, high) with patch('sys.stdout', new=StringIO()) as fake_out: primes_between(low, high) self.assertEqual(fake_out.getvalue().strip(), expected_output)
def test_range_below_2(self): low, high = 1, 6 expected_output = '' with patch('sys.stdout', new=StringIO()) as fake_out: primes_between(low, high) self.assertEqual(fake_out.getvalue().strip(), expected_output)
def test_one_prime_greater_than_range_low(self): low, high = 24, 30 expected_output = self.get_expected_string(low, high) with patch('sys.stdout', new=StringIO()) as fake_out: primes_between(low, high) self.assertEqual(fake_out.getvalue().strip(), expected_output)