assert_exception is assertRaises

This commit is contained in:
hugovk 2014-06-05 11:45:01 +03:00
parent d385dd81a7
commit 133120c6a6
2 changed files with 5 additions and 5 deletions

View File

@ -30,13 +30,13 @@ script:
# Don't cover PyPy: it fails intermittently and is x5.8 slower (#640)
- if [ "$TRAVIS_PYTHON_VERSION" == "pypy" ]; then python selftest.py; fi
- if [ "$TRAVIS_PYTHON_VERSION" == "pypy" ]; then python Tests/run.py; fi
- if [ "$TRAVIS_PYTHON_VERSION" == "pypy" ]; then nosetests test/; fi
- if [ "$TRAVIS_PYTHON_VERSION" == "pypy" ]; then python Tests/run.py; fi
# Cover the others
- if [ "$TRAVIS_PYTHON_VERSION" != "pypy" ]; then coverage run --append --include=PIL/* selftest.py; fi
- if [ "$TRAVIS_PYTHON_VERSION" != "pypy" ]; then python Tests/run.py --coverage; fi
- if [ "$TRAVIS_PYTHON_VERSION" != "pypy" ]; then coverage run --append --include=PIL/* -m nose test/; fi
- if [ "$TRAVIS_PYTHON_VERSION" != "pypy" ]; then python Tests/run.py --coverage; fi
after_success:

View File

@ -18,8 +18,8 @@ class TestImageLoad(PillowTestCase):
def test_close(self):
im = Image.open("Images/lena.gif")
im.close()
self.assert_exception(ValueError, lambda: im.load())
self.assert_exception(ValueError, lambda: im.getpixel((0, 0)))
self.assertRaises(ValueError, lambda: im.load())
self.assertRaises(ValueError, lambda: im.getpixel((0, 0)))
def test_contextmanager(self):
fn = None
@ -27,7 +27,7 @@ class TestImageLoad(PillowTestCase):
fn = im.fp.fileno()
os.fstat(fn)
self.assert_exception(OSError, lambda: os.fstat(fn))
self.assertRaises(OSError, lambda: os.fstat(fn))
if __name__ == '__main__':
unittest.main()