Skip to content

Instantly share code, notes, and snippets.

@snebel29
Created May 24, 2017 17:38
Show Gist options
  • Select an option

  • Save snebel29/5e1ef47f6dabcefde9a2d4a7212f3237 to your computer and use it in GitHub Desktop.

Select an option

Save snebel29/5e1ef47f6dabcefde9a2d4a7212f3237 to your computer and use it in GitHub Desktop.
import unittest
class TestGen(unittest.TestCase):
def test_generator(self):
def gen():
i = 1
while i < 10:
yield i
i += 1
for i in gen():
print(i)
assert(1, next(gen()))
assert(2, next(gen()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment