Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

with_using_generator.py 342B

1234567891011121314
  1. """ Testing with statements that use generators. This should not crash. """
  2. class Base(object):
  3. """ Base class. """
  4. val = 0
  5. def gen(self):
  6. """ A generator. """
  7. yield self.val
  8. def fun(self):
  9. """ With statement using a generator. """
  10. with self.gen(): # [not-context-manager]
  11. pass