File: withbug.py

package info (click to toggle)
pydb 1.26-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, wheezy
  • size: 2,460 kB
  • ctags: 1,061
  • sloc: python: 4,200; perl: 2,479; sh: 873; lisp: 866; makefile: 634; ansic: 16
file content (22 lines) | stat: -rw-r--r-- 310 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from __future__ import with_statement
    
class FakeClass:

    def __init__(self):
        x = 1
        return
    
    def __enter__(self):
        return 1

    def __exit__(self, type, value, traceback):
        return 2

def test():
  with FakeClass() as f:
      print f
      return
  return

test()