diff options
author | Damien George <damien.p.george@gmail.com> | 2014-07-05 06:14:29 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-07-05 06:14:29 +0100 |
commit | 539681fffd96082ca3b5d18643d4f08f65c47170 (patch) | |
tree | 7e6f8332c6e7737b768750e67265bb02b22932e6 /tests/io/file_with.py | |
parent | 0182385ab0b4a1b2e549c92f8f5b621135aeb975 (diff) |
tests: Rename test scripts, changing - to _ for consistency.
From now on, all new tests must use underscore.
Addresses issue #727.
Diffstat (limited to 'tests/io/file_with.py')
-rw-r--r-- | tests/io/file_with.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/io/file_with.py b/tests/io/file_with.py new file mode 100644 index 000000000..ee1e70242 --- /dev/null +++ b/tests/io/file_with.py @@ -0,0 +1,21 @@ +f = open("io/data/file1") + +with f as f2: + print(f2.read()) + +# File should be closed +try: + f.read() +except: + # Note: CPython and us throw different exception trying to read from + # close file. + print("can't read file after with") + + +# Regression test: test that exception in with initialization properly +# thrown and doesn't crash. +try: + with open('__non_existent', 'r'): + pass +except OSError: + print("OSError") |