def test_primes(self): with open('tests/data_primes.json') as file: data = json.load(file) p = iter(primes()) for prime in data: self.assertEqual(next(p), prime)
def test_primes(): with open('tests/data_primes.json') as file: data = json.load(file) p = iter(primes()) for prime in data: assert next(p) == prime
def test_is_generator(self): gen = primes() self.assertIn('__init__', dir(gen)) self.assertIn('__next__', dir(gen))
def test_primes_is_iterable(): gen = primes() assert '__init__' in dir(gen) assert '__next__' in dir(gen)