'The correct IOError is raised when the upload directory name exists but isn\'t a directory'

def test_not_a_directory(self):

    open(UPLOAD_TO, u'wb').close()
    self.addCleanup(os.remove, UPLOAD_TO)
    with self.assertRaises(IOError) as exc_info:
        self.obj.testfile.save(u'foo.txt', SimpleUploadedFile(u'foo.txt', 'x'))
    self.assertEqual(exc_info.exception.args[0], (u'%s    exists    and    is    not    a    directory.' % UPLOAD_TO))
