diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2011-03-03 15:04:39 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2011-03-03 15:04:39 +0000 |
| commit | afd040d4d3a06fe92e3080870b2ff2095ce86a75 (patch) | |
| tree | bda969614999a3fcfbf1466caa0d75e512dd1374 /tests/regressiontests/file_uploads | |
| parent | b7c41c1fbb2d45634dde5f7a450ba1a5aea5a8af (diff) | |
Updated test assertions that have been deprecated by the move to unittest2. In summary, this means:
assert_ -> assertTrue
assertEquals -> assertEqual
failUnless -> assertTrue
For full details, see http://www.voidspace.org.uk/python/articles/unittest2.shtml#deprecations
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15728 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/file_uploads')
| -rw-r--r-- | tests/regressiontests/file_uploads/tests.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/regressiontests/file_uploads/tests.py b/tests/regressiontests/file_uploads/tests.py index 31f2297d4f..6dba4731fd 100644 --- a/tests/regressiontests/file_uploads/tests.py +++ b/tests/regressiontests/file_uploads/tests.py @@ -148,7 +148,7 @@ class FileUploadTests(TestCase): 'wsgi.input': client.FakePayload(payload), } got = simplejson.loads(self.client.request(**r).content) - self.assert_(len(got['file']) < 256, "Got a long file name (%s characters)." % len(got['file'])) + self.assertTrue(len(got['file']) < 256, "Got a long file name (%s characters)." % len(got['file'])) def test_custom_upload_handler(self): # A small file (under the 5M quota) @@ -164,12 +164,12 @@ class FileUploadTests(TestCase): # Small file posting should work. response = self.client.post('/file_uploads/quota/', {'f': smallfile}) got = simplejson.loads(response.content) - self.assert_('f' in got) + self.assertTrue('f' in got) # Large files don't go through. response = self.client.post("/file_uploads/quota/", {'f': bigfile}) got = simplejson.loads(response.content) - self.assert_('f' not in got) + self.assertTrue('f' not in got) def test_broken_custom_upload_handler(self): f = tempfile.NamedTemporaryFile() @@ -275,7 +275,7 @@ class DirectoryCreationTests(unittest.TestCase): try: self.obj.testfile.save('foo.txt', SimpleUploadedFile('foo.txt', 'x')) except OSError, err: - self.assertEquals(err.errno, errno.EACCES) + self.assertEqual(err.errno, errno.EACCES) except Exception, err: self.fail("OSError [Errno %s] not raised." % errno.EACCES) @@ -289,7 +289,7 @@ class DirectoryCreationTests(unittest.TestCase): except IOError, err: # The test needs to be done on a specific string as IOError # is raised even without the patch (just not early enough) - self.assertEquals(err.args[0], + self.assertEqual(err.args[0], "%s exists and is not a directory." % UPLOAD_TO) except: self.fail("IOError not raised") |
