Commits

Ronald Oussoren committed 0294dd4

Port to py3k

  • Participants
  • Parent commits 401f8ec
  • Branches pyobjc-ancient

Comments (0)

Files changed (14)

File pyobjc-framework-CFNetwork/Modules/_manual.m

 
 
 
-static PyMethodDef m_methods[] = {
+static PyMethodDef mod_methods[] = {
 #if PyObjC_BUILD_RELEASE >= 1005
 	{
 		"CFNetworkExecuteProxyAutoConfigurationScript",
 	{ 0, 0, 0, }
 };
 
+#if PY_MAJOR_VERSION == 3
+
+static struct PyModuleDef mod_module = {
+	PyModuleDef_HEAD_INIT,
+	"_manual",
+	NULL,
+	0,
+	mod_methods,
+	NULL,
+	NULL,
+	NULL,
+	NULL
+};
+
+#define INITERROR() return NULL
+#define INITDONE() return m
+
+PyObject* PyInit__manual(void);
+
+PyObject*
+PyInit__manual(void)
+
+#else
+
+#define INITERROR() return
+#define INITDONE() return
+
+
+
 void init_manual(void);
 void init_manual(void)
+#endif
 {
-	PyObject* m = Py_InitModule4("_manual", m_methods,
+	PyObject* m;
+
+#if PY_MAJOR_VERSION == 3
+	m = PyModule_Create(&mod_module);
+#else
+	m = Py_InitModule4("_manual", mod_methods,
 		NULL, NULL, PYTHON_API_VERSION);
+#endif
+	if (!m) {
+		INITERROR();
+	}
 
-        if (PyObjC_ImportAPI(m) < 0) { return; }
+        if (PyObjC_ImportAPI(m) < 0) { 
+		INITERROR();
+	}
 
 #if PyObjC_BUILD_RELEASE >= 1005
 	if (CFNetworkExecuteProxyAutoConfigurationScript == NULL) {
-		PyDict_DelItemString(m, "CFNetworkExecuteProxyAutoConfigurationScript");
+		if (PyDict_DelItemString(m, "CFNetworkExecuteProxyAutoConfigurationScript") < 0) {
+			INITERROR();
+		}
 	}
 	if (CFNetworkExecuteProxyAutoConfigurationURL == NULL) {
-		PyDict_DelItemString(m, "CFNetworkExecuteProxyAutoConfigurationURL");
+		if (PyDict_DelItemString(m, "CFNetworkExecuteProxyAutoConfigurationURL") < 0) {
+			INITERROR();
+		}
 	}
 #endif
+
+	INITDONE();
 }

File pyobjc-framework-CFNetwork/Modules/pyobjc-api.h

-#ifndef PyObjC_API_H
-#define PyObjC_API_H
-
-/*
- * Use this in helper modules for the objc package, and in wrappers
- * for functions that deal with objective-C objects/classes
- * 
- * This header defines some utility wrappers for importing and using 
- * the core bridge. 
- *
- * This is the *only* header file that should be used to access 
- * functionality in the core bridge.
- *
- * WARNING: this file is not part of the public interface of PyObjC and
- * might change or be removed without warning or regard for backward
- * compatibility.
- */
-
-#include "Python.h"
-#include <objc/objc.h>
-
-#import <Foundation/Foundation.h>
-
-#ifndef CGFLOAT_DEFINED
-
-#ifdef __LP64__
-# error "Huh? 64-bit but no CFFloat available???"
-#endif
-
-typedef float CGFloat;
-#define CGFLOAT_MIN FLT_MIN
-#define CGFLOAT_MAX FLT_MAX
-#define CGFLOAT_IS_DOUBLE 0
-#define CGFLOAT_DEFINED
-
-#endif /* CGFLOAT_DEFINED */
-
-
-#ifndef NSINTEGER_DEFINED
-
-#ifdef __LP64__
-# error "Huh? 64-bit but no NSINTEGER available???"
-#endif
-
-typedef int NSInteger;
-typedef unsigned int NSUInteger;
-
-#define NSIntegerMax    LONG_MAX
-#define NSIntegerMin    LONG_MIN
-#define NSUIntegerMax   ULONG_MAX
-
-#define NSINTEGER_DEFINED
-
-#endif
-
-
-#ifndef PyObjC_COMPAT_H
-#if (PY_VERSION_HEX < 0x02050000)
-typedef int Py_ssize_t;
-#define PY_FORMAT_SIZE_T ""
-#define Py_ARG_SIZE_T "n"
-#define PY_SSIZE_T_MAX INT_MAX
-
-#else
-
-#define Py_ARG_SIZE_T "i"
-#endif
-#endif
-
-#import <Foundation/NSException.h>
-
-struct PyObjC_WeakLink {
-	const char* name;
-	void (*func)(void);
-};
-
-
-/* threading support */
-#ifdef NO_OBJC2_RUNTIME
-#define PyObjC_DURING \
-		Py_BEGIN_ALLOW_THREADS \
-		NS_DURING
-
-#define PyObjC_HANDLER NS_HANDLER
-
-#define PyObjC_ENDHANDLER \
-		NS_ENDHANDLER \
-		Py_END_ALLOW_THREADS
-#else
-
-#define	PyObjC_DURING \
-		Py_BEGIN_ALLOW_THREADS \
-		@try {
-
-#define PyObjC_HANDLER } @catch(volatile NSObject* _localException) { \
-		NSException* localException __attribute__((__unused__))= (NSException*)_localException;
-
-#define PyObjC_ENDHANDLER \
-		} \
-		Py_END_ALLOW_THREADS
-
-#endif
-
-#define PyObjC_BEGIN_WITH_GIL \
-	{ \
-		PyGILState_STATE _GILState; \
-		_GILState = PyGILState_Ensure(); 
-
-#define PyObjC_GIL_FORWARD_EXC() \
-		do { \
-            PyObjCErr_ToObjCWithGILState(&_GILState); \
-		} while (0)
-
-
-#define PyObjC_GIL_RETURN(val) \
-		do { \
-			PyGILState_Release(_GILState); \
-			return (val); \
-		} while (0)
-
-#define PyObjC_GIL_RETURNVOID \
-		do { \
-			PyGILState_Release(_GILState); \
-			return; \
-		} while (0)
-
-
-#define PyObjC_END_WITH_GIL \
-		PyGILState_Release(_GILState); \
-	}
-
-
-
-#include <objc/objc-runtime.h>
-
-/* On 10.1 there are no defines for the OS version. */
-#ifndef MAC_OS_X_VERSION_10_1
-#define MAC_OS_X_VERSION_10_1 1010
-#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_1
-
-#error "MAC_OS_X_VERSION_10_1 not defined. You aren't running 10.1 are you?"
-
-#endif
-
-#ifndef MAC_OS_X_VERSION_10_2
-#define MAC_OS_X_VERSION_10_2 1020
-#endif
-
-#ifndef MAC_OS_X_VERSION_10_3
-#define MAC_OS_X_VERSION_10_3 1030
-#endif
-
-#ifndef MAC_OS_X_VERSION_10_4
-#define MAC_OS_X_VERSION_10_4 1040
-#endif
-
-#ifndef MAC_OS_X_VERSION_10_5
-#define MAC_OS_X_VERSION_10_5 1050
-#endif
-
-/* Current API version, increase whenever:
- * - Semantics of current functions change
- * - Functions are removed
- * Do not increase when adding a new function, the struct_len field
- * can be used for detecting if a function has been added.
- *
- * HISTORY:
- * - Version 2.2 adds PyObjCUnsupportedMethod_IMP 
- *       and PyObjCUnsupportedMethod_Caller 
- * - Version 2.1 adds PyObjCPointerWrapper_Register 
- * - Version 2 adds an argument to PyObjC_InitSuper
- * - Version 3 adds another argument to PyObjC_CallPython
- * - Version 4 adds PyObjCErr_ToObjCGILState
- * - Version 4.1 adds PyObjCRT_AlignOfType and PyObjCRT_SizeOfType
- *         (PyObjC_SizeOfType is now deprecated)
- * - Version 4.2 adds PyObjCRT_SELName
- * - Version 4.3 adds PyObjCRT_SimplifySignature
- * - Version 4.4 adds PyObjC_FreeCArray, PyObjC_PythonToCArray and
- *   		PyObjC_CArrayToPython
- * - Version 5 modifies the signature for PyObjC_RegisterMethodMapping,
- *	PyObjC_RegisterSignatureMapping and PyObjCUnsupportedMethod_IMP,
- *      adds PyObjC_RegisterStructType and removes PyObjC_CallPython
- * - Version 6 adds PyObjCIMP_Type, PyObjCIMP_GetIMP and PyObjCIMP_GetSelector
- * - Version 7 adds PyObjCErr_AsExc, PyGILState_Ensure
- * - Version 8 adds PyObjCObject_IsUninitialized,
-        removes PyObjCSelector_IsInitializer
- * - Version 9 (???)
- * - Version 10 changes the signature of PyObjCRT_SimplifySignature
- * - Version 11 adds PyObjCObject_Convert, PyObjCSelector_Convert,
-     PyObjCClass_Convert, PyObjC_ConvertBOOL, and PyObjC_ConvertChar
- * - Version 12 adds PyObjCObject_New
- * - Version 13 adds PyObjCCreateOpaquePointerType
- * - Version 14 adds PyObjCObject_NewTransient, PyObjCObject_ReleaseTransient
- * - Version 15 changes the interface of PyObjCObject_New
- * - Version 16 adds PyObjC_PerformWeaklinking
- * - Version 17 introduces Py_ssize_t support
- * - Version 18 introduces several API incompatibilities
- */
-#define PYOBJC_API_VERSION 18
-
-#define PYOBJC_API_NAME "__C_API__"
-
-/* 
- * Only add items to the end of this list!
- */
-typedef int (RegisterMethodMappingFunctionType)(
-			Class, 
-			SEL, 
-			PyObject *(*)(PyObject*, PyObject*, PyObject*),
-			void (*)(void*, void*, void**, void*));
-
-struct pyobjc_api {
-	int	      api_version;	/* API version */
-	size_t	      struct_len;	/* Length of this struct */
-	PyTypeObject* class_type;	/* PyObjCClass_Type    */
-	PyTypeObject* object_type;	/* PyObjCObject_Type   */
-	PyTypeObject* select_type;	/* PyObjCSelector_Type */
-
-	/* PyObjC_RegisterMethodMapping */
-	RegisterMethodMappingFunctionType *register_method_mapping;
-
-	/* PyObjC_RegisterSignatureMapping */
-	int (*register_signature_mapping)(
-			char*,
-			PyObject *(*)(PyObject*, PyObject*, PyObject*),
-			void (*)(void*, void*, void**, void*));
-
-	/* PyObjCObject_GetObject */
-	id (*obj_get_object)(PyObject*);
-
-	/* PyObjCObject_ClearObject */
-	void (*obj_clear_object)(PyObject*);
-
-	/* PyObjCClass_GetClass */
-	Class (*cls_get_class)(PyObject*);
-
-	/* PyObjCClass_New */
-	PyObject* (*cls_to_python)(Class cls);
-
-	/* PyObjC_PythonToId */
-	id (*python_to_id)(PyObject*);
-
-	/* PyObjC_IdToPython */
-	PyObject* (*id_to_python)(id);
-
-	/* PyObjCErr_FromObjC */
-	void (*err_objc_to_python)(NSException*);
-
-	/* PyObjCErr_ToObjC */
-	void (*err_python_to_objc)(void);
-
-	/* PyObjC_PythonToObjC */
-	int (*py_to_objc)(const char*, PyObject*, void*);
-
-	/* PyObjC_ObjCToPython */
-	PyObject* (*objc_to_py)(const char*, void*);
-
-	/* PyObjC_SizeOfType */
-	Py_ssize_t   (*sizeof_type)(const char*);
-
-	/* PyObjCSelector_GetClass */
-	Class	   (*sel_get_class)(PyObject* sel);
-
-	/* PyObjCSelector_GetSelector */
-	SEL	   (*sel_get_sel)(PyObject* sel);
-
-	/* PyObjC_InitSuper */ 	
-	void	(*fill_super)(struct objc_super*, Class, id);
-
-	/* PyObjC_InitSuperCls */
-	void	(*fill_super_cls)(struct objc_super*, Class, Class);
-
-	/* PyObjCPointerWrapper_Register */ 
-	int  (*register_pointer_wrapper)(
-		        const char*, PyObject* (*pythonify)(void*),
-			int (*depythonify)(PyObject*, void*)
-		);
-
-	void (*unsupported_method_imp)(void*, void*, void**, void*);
-	PyObject* (*unsupported_method_caller)(PyObject*, PyObject*, PyObject*);
-
-	/* PyObjCErr_ToObjCWithGILState */
-	void (*err_python_to_objc_gil)(PyGILState_STATE* state);
-
-	/* PyObjCRT_AlignOfType */
-	Py_ssize_t (*alignof_type)(const char* typestr);
-
-	/* PyObjCRT_SELName */
-	const char* (*selname)(SEL sel);
-
-	/* PyObjCRT_SimplifySignature */
-	int (*simplify_sig)(char* signature, char* buf, size_t buflen);
-
-	/* PyObjC_FreeCArray */
-	void    (*free_c_array)(int,void*);
-
-	/* PyObjC_PythonToCArray */
-	int     (*py_to_c_array)(BOOL, BOOL, const char*, PyObject*, void**, Py_ssize_t*, PyObject**);
-	
-	/* PyObjC_CArrayToPython */
-	PyObject* (*c_array_to_py)(const char*, void*, Py_ssize_t);
-
-	/* PyObjC_RegisterStructType */
-	PyObject* (*register_struct)(const char*, const char*, const char*, initproc, Py_ssize_t, const char**);
-
-	/* PyObjCIMP_Type */
-	PyTypeObject* imp_type;
-
-	/* PyObjCIMP_GetIMP */
-	IMP  (*imp_get_imp)(PyObject*);
-
-	/* PyObjCIMP_GetSelector */
-	SEL  (*imp_get_sel)(PyObject*);
-
-	/* PyObjCErr_AsExc */
-	NSException* (*err_python_to_nsexception)(void);
-
-	/* PyGILState_Ensure */
-	PyGILState_STATE (*gilstate_ensure)(void);
-
-	/* PyObjCObject_IsUninitialized */
-	int (*obj_is_uninitialized)(PyObject*);
-
-	/* PyObjCObject_Convert */
-	int (*pyobjcobject_convert)(PyObject*,void*);
-
-	/* PyObjCSelector_Convert */
-	int (*pyobjcselector_convert)(PyObject*,void*);
-
-	/* PyObjCClass_Convert */
-	int (*pyobjcclass_convert)(PyObject*,void*);
-
-	/* PyObjC_ConvertBOOL */
-	int (*pyobjc_convertbool)(PyObject*,void*);
-
-	/* PyObjC_ConvertChar */
-	int (*pyobjc_convertchar)(PyObject*,void*);
-
-	/* PyObjCObject_New */
-	PyObject* (*pyobjc_object_new)(id, int , int);
-
-	/* PyObjCCreateOpaquePointerType */
-	PyObject* (*pointer_type_new)(const char*, const char*, const char*);
-
-	/* PyObject* PyObjCObject_NewTransient(id objc_object, int* cookie); */
-	PyObject* (*newtransient)(id objc_object, int* cookie);
-
-	/* void PyObjCObject_ReleaseTransient(PyObject* proxy, int cookie); */
-	void (*releasetransient)(PyObject* proxy, int cookie);
-
-	void (*doweaklink)(PyObject*, struct PyObjC_WeakLink*);
-
-	const char* (*removefields)(char*, const char*);
-
-	PyObject** pyobjc_null;
-
-	int (*dep_c_array_count)(const char* type, Py_ssize_t count, BOOL strict, PyObject* value, void* datum);
-
-	PyObject* (*varlistnew)(const char* tp, void* array);
-};
-
-#ifndef PYOBJC_BUILD
-
-#ifndef PYOBJC_METHOD_STUB_IMPL
-static struct pyobjc_api*	PyObjC_API;
-#endif /* PYOBJC_METHOD_STUB_IMPL */
-
-#define PyObjCObject_Check(obj) PyObject_TypeCheck(obj, PyObjC_API->object_type)
-#define PyObjCClass_Check(obj)  PyObject_TypeCheck(obj, PyObjC_API->class_type)
-#define PyObjCSelector_Check(obj)  PyObject_TypeCheck(obj, PyObjC_API->select_type)
-#define PyObjCIMP_Check(obj)  PyObject_TypeCheck(obj, PyObjC_API->imp_type)
-#define PyObjCObject_GetObject (PyObjC_API->obj_get_object)
-#define PyObjCObject_ClearObject (PyObjC_API->obj_clear_object)
-#define PyObjCClass_GetClass   (PyObjC_API->cls_get_class)
-#define PyObjCClass_New 	     (PyObjC_API->cls_to_python)
-#define PyObjCSelector_GetClass (PyObjC_API->sel_get_class)
-#define PyObjCSelector_GetSelector (PyObjC_API->sel_get_sel)
-#define PyObjC_PythonToId      (PyObjC_API->python_to_id)
-#define PyObjC_IdToPython      (PyObjC_API->id_to_python)
-#define PyObjCErr_FromObjC     (PyObjC_API->err_objc_to_python)
-#define PyObjCErr_ToObjC       (PyObjC_API->err_python_to_objc)
-#define PyObjCErr_ToObjCWithGILState       (PyObjC_API->err_python_to_objc_gil)
-#define PyObjCErr_AsExc        (PyObjC_API->err_python_to_nsexception)
-#define PyObjC_PythonToObjC    (PyObjC_API->py_to_objc)
-#define PyObjC_ObjCToPython    (PyObjC_API->objc_to_py)
-#define PyObjC_RegisterMethodMapping (PyObjC_API->register_method_mapping)
-#define PyObjC_RegisterSignatureMapping (PyObjC_API->register_signature_mapping)
-#define PyObjC_SizeOfType      (PyObjC_API->sizeof_type)
-#define PyObjC_PythonToObjC   (PyObjC_API->py_to_objc)
-#define PyObjC_ObjCToPython   (PyObjC_API->objc_to_py)
-#define PyObjC_InitSuper	(PyObjC_API->fill_super)
-#define PyObjC_InitSuperCls	(PyObjC_API->fill_super_cls)
-#define PyObjCPointerWrapper_Register (PyObjC_API->register_pointer_wrapper)
-#define PyObjCUnsupportedMethod_IMP (PyObjC_API->unsupported_method_imp)
-#define PyObjCUnsupportedMethod_Caller (PyObjC_API->unsupported_method_caller)
-#define PyObjCRT_SizeOfType      (PyObjC_API->sizeof_type)
-#define PyObjCRT_AlignOfType	(PyObjC_API->alignof_type)
-#define PyObjCRT_SELName	(PyObjC_API->selname)
-#define PyObjCRT_SimplifySignature	(PyObjC_API->simplify_sig)
-#define PyObjC_FreeCArray	(PyObjC_API->free_c_array)
-#define PyObjC_PythonToCArray	(PyObjC_API->py_to_c_array)
-#define PyObjC_CArrayToPython	(PyObjC_API->c_array_to_py)
-#define PyObjC_RegisterStructType   (PyObjC_API->register_struct)
-#define PyObjCIMP_GetIMP   (PyObjC_API->imp_get_imp)
-#define PyObjCIMP_GetSelector   (PyObjC_API->imp_get_sel)
-#define PyObjCObject_IsUninitialized (PyObjC_API->obj_is_uninitialized)
-#define PyObjCObject_Convert (PyObjC_API->pyobjcobject_convert)
-#define PyObjCSelector_Convert (PyObjC_API->pyobjcselector_convert)
-#define PyObjCClass_Convert (PyObjC_API->pyobjcselector_convert)
-#define PyObjC_ConvertBOOL (PyObjC_API->pyobjc_convertbool)
-#define PyObjC_ConvertChar (PyObjC_API->pyobjc_convertchar)
-#define PyObjCObject_New (PyObjC_API->pyobjc_object_new)
-#define PyObjCCreateOpaquePointerType (PyObjC_API->pointer_type_new)
-#define PyObjCObject_NewTransient (PyObjC_API->newtransient)
-#define PyObjCObject_ReleaseTransient (PyObjC_API->releasetransient)
-#define PyObjC_PerformWeaklinking (PyObjC_API->doweaklink)
-#define PyObjCRT_RemoveFieldNames (PyObjC_API->removefields)
-#define PyObjC_NULL		  (*(PyObjC_API->pyobjc_null))
-#define PyObjC_DepythonifyCArray  (PyObjC_API->dep_c_array_count)
-#define PyObjC_VarList_New  (PyObjC_API->varlistnew)
-
-
-#ifndef PYOBJC_METHOD_STUB_IMPL
-
-static int
-PyObjC_ImportAPI(PyObject* calling_module)
-{
-	PyObject* m;
-	PyObject* d;
-	PyObject* api_obj;
-	PyObject* name = PyString_FromString("objc");
-	
-	m = PyImport_Import(name);
-	Py_DECREF(name);
-	if (m == NULL) {
-		return -1;
-	}
-
-	d = PyModule_GetDict(m);
-	if (d == NULL) {
-		PyErr_SetString(PyExc_RuntimeError, 
-			"No dict in objc module");
-		return -1;
-	}
-
-	api_obj = PyDict_GetItemString(d, PYOBJC_API_NAME);
-	if (api_obj == NULL) {
-		PyErr_SetString(PyExc_RuntimeError, 
-			"No C_API in objc module");
-		return -1;
-	}
-	PyObjC_API = PyCObject_AsVoidPtr(api_obj);
-	if (PyObjC_API == NULL) {
-		return 0;
-	}
-	if (PyObjC_API->api_version != PYOBJC_API_VERSION) {
-		PyErr_SetString(PyExc_RuntimeError,
-			"Wrong version of PyObjC C API");
-		return -1;
-	}
-	
-	if (PyObjC_API->struct_len < sizeof(struct pyobjc_api)) {
-		PyErr_SetString(PyExc_RuntimeError,
-			"Wrong struct-size of PyObjC C API");
-		return -1;
-	}
-
-	Py_INCREF(api_obj);
-
-	/* Current pyobjc implementation doesn't allow deregistering 
-	 * information, avoid unloading of users of the C-API.
-	 * (Yes this is ugle, patches to fix this situation are apriciated)
-	 */
-	Py_INCREF(calling_module);
-
-	return 0;
-}
-#endif /* PYOBJC_METHOD_STUB_IMPL */
-
-#else /* PyObjC_BUILD */
-
-extern struct pyobjc_api	objc_api;
-
-#endif /* !PYOBJC_BUILD */
-
-#endif /*  PyObjC_API_H */

File pyobjc-framework-CFNetwork/PyObjCTest/test_cfftpstream.py

 class TestCFFTPStream (TestCase):
 
     def testConstants(self):
-        self.failUnlessIsInstance(kCFStreamErrorDomainFTP, (int, long))
-        self.failUnlessIsInstance(kCFStreamPropertyFTPUserName, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertyFTPPassword, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertyFTPUsePassiveMode, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertyFTPResourceSize, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertyFTPFetchResourceInfo, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertyFTPFileTransferOffset, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertyFTPAttemptPersistentConnection, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertyFTPProxy, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertyFTPProxyHost, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertyFTPProxyPort, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertyFTPProxyUser, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertyFTPProxyPassword, unicode)
-        self.failUnlessIsInstance(kCFFTPResourceMode, unicode)
-        self.failUnlessIsInstance(kCFFTPResourceName, unicode)
-        self.failUnlessIsInstance(kCFFTPResourceOwner, unicode)
-        self.failUnlessIsInstance(kCFFTPResourceGroup, unicode)
-        self.failUnlessIsInstance(kCFFTPResourceLink, unicode)
-        self.failUnlessIsInstance(kCFFTPResourceSize, unicode)
-        self.failUnlessIsInstance(kCFFTPResourceType, unicode)
-        self.failUnlessIsInstance(kCFFTPResourceModDate, unicode)
+        self.assertIsInstance(kCFStreamErrorDomainFTP, (int, long))
+        self.assertIsInstance(kCFStreamPropertyFTPUserName, unicode)
+        self.assertIsInstance(kCFStreamPropertyFTPPassword, unicode)
+        self.assertIsInstance(kCFStreamPropertyFTPUsePassiveMode, unicode)
+        self.assertIsInstance(kCFStreamPropertyFTPResourceSize, unicode)
+        self.assertIsInstance(kCFStreamPropertyFTPFetchResourceInfo, unicode)
+        self.assertIsInstance(kCFStreamPropertyFTPFileTransferOffset, unicode)
+        self.assertIsInstance(kCFStreamPropertyFTPAttemptPersistentConnection, unicode)
+        self.assertIsInstance(kCFStreamPropertyFTPProxy, unicode)
+        self.assertIsInstance(kCFStreamPropertyFTPProxyHost, unicode)
+        self.assertIsInstance(kCFStreamPropertyFTPProxyPort, unicode)
+        self.assertIsInstance(kCFStreamPropertyFTPProxyUser, unicode)
+        self.assertIsInstance(kCFStreamPropertyFTPProxyPassword, unicode)
+        self.assertIsInstance(kCFFTPResourceMode, unicode)
+        self.assertIsInstance(kCFFTPResourceName, unicode)
+        self.assertIsInstance(kCFFTPResourceOwner, unicode)
+        self.assertIsInstance(kCFFTPResourceGroup, unicode)
+        self.assertIsInstance(kCFFTPResourceLink, unicode)
+        self.assertIsInstance(kCFFTPResourceSize, unicode)
+        self.assertIsInstance(kCFFTPResourceType, unicode)
+        self.assertIsInstance(kCFFTPResourceModDate, unicode)
 
     def testFunctions(self):
-        self.failUnlessResultIsCFRetained(CFReadStreamCreateWithFTPURL)
+        self.assertResultIsCFRetained(CFReadStreamCreateWithFTPURL)
         url = CFURLCreateWithString(None, "ftp://ftp.python.org/", None)
-        self.failUnlessIsInstance(url, CFURLRef)
+        self.assertIsInstance(url, CFURLRef)
         ftp = CFReadStreamCreateWithFTPURL(None,  url)
-        self.failUnlessIsInstance(ftp, CFReadStreamRef)
+        self.assertIsInstance(ftp, CFReadStreamRef)
 
-        buf = '-rw-r--r--  1 ronald  staff  1957 Mar 31 07:22 test_cfftpstream.py\r\n'
-        self.failUnlessArgHasType(CFFTPCreateParsedResourceListing, 1, 'n^v')
-        self.failUnlessArgSizeInArg(CFFTPCreateParsedResourceListing, 1, 2)
-        self.failUnlessArgIsOut(CFFTPCreateParsedResourceListing, 3)
+        buf = b'-rw-r--r--  1 ronald  staff  1957 Mar 31 07:22 test_cfftpstream.py\r\n'
+        self.assertArgHasType(CFFTPCreateParsedResourceListing, 1, b'n^v')
+        self.assertArgSizeInArg(CFFTPCreateParsedResourceListing, 1, 2)
+        self.assertArgIsOut(CFFTPCreateParsedResourceListing, 3)
         cnt, out = CFFTPCreateParsedResourceListing(None, buf, len(buf), None)
-        self.failUnlessIsInstance(cnt, (int, long))
-        self.failUnlessIsInstance(out, CFDictionaryRef)
-        self.failUnlessEqual(out[kCFFTPResourceGroup], "staff")
+        self.assertIsInstance(cnt, (int, long))
+        self.assertIsInstance(out, CFDictionaryRef)
+        self.assertEqual(out[kCFFTPResourceGroup], "staff")
 
-        self.failUnlessResultIsCFRetained(CFWriteStreamCreateWithFTPURL)
+        self.assertResultIsCFRetained(CFWriteStreamCreateWithFTPURL)
         url = CFURLCreateWithString(None, "ftp://www.rivm.nl/incoming/test.txt", None)
-        self.failUnlessIsInstance(url, CFURLRef)
+        self.assertIsInstance(url, CFURLRef)
         ftp = CFWriteStreamCreateWithFTPURL(None,  url)
-        self.failUnlessIsInstance(ftp, CFWriteStreamRef)
+        self.assertIsInstance(ftp, CFWriteStreamRef)
 
 if __name__ == "__main__":
     main()

File pyobjc-framework-CFNetwork/PyObjCTest/test_cfhost.py

 from CFNetwork import *
 from PyObjCTools.TestSupport import *
+import sys
+
+if sys.version_info[0] != 2:
+    def buffer(value):
+        return value.encode('latin1')
 
 class TestCFHost (TestCase):
     def testTypes(self):
-        self.failUnlessIsCFType(CFHostRef)
+        self.assertIsCFType(CFHostRef)
 
     def testConstants(self):
-        self.failUnlessIsInstance(kCFStreamErrorDomainNetDB, (int, long))
-        self.failUnlessIsInstance(kCFStreamErrorDomainSystemConfiguration, (int, long))
-        self.failUnlessEqual(kCFHostAddresses, 0)
-        self.failUnlessEqual(kCFHostNames, 1)
-        self.failUnlessEqual(kCFHostReachability, 2)
+        self.assertIsInstance(kCFStreamErrorDomainNetDB, (int, long))
+        self.assertIsInstance(kCFStreamErrorDomainSystemConfiguration, (int, long))
+        self.assertEqual(kCFHostAddresses, 0)
+        self.assertEqual(kCFHostNames, 1)
+        self.assertEqual(kCFHostReachability, 2)
 
     def testFunctions(self):
-        self.failUnlessIsInstance(CFHostGetTypeID(), (int, long))
+        self.assertIsInstance(CFHostGetTypeID(), (int, long))
 
-        self.failUnlessResultIsCFRetained(CFHostCreateWithName)
+        self.assertResultIsCFRetained(CFHostCreateWithName)
         v = CFHostCreateWithName(None, u"www.python.org")
-        self.failUnlessIsInstance(v, CFHostRef)
+        self.assertIsInstance(v, CFHostRef)
 
 
         addr = ' ' * 24;
-        self.failUnlessResultIsCFRetained(CFHostCreateWithAddress)
+        self.assertResultIsCFRetained(CFHostCreateWithAddress)
         t = CFHostCreateWithAddress(None, buffer(addr))
-        self.failUnlessIsInstance(t, CFHostRef)
+        self.assertIsInstance(t, CFHostRef)
 
-        self.failUnlessResultIsBOOL(CFHostStartInfoResolution)
-        self.failUnlessArgIsOut(CFHostStartInfoResolution, 2)
+        self.assertResultIsBOOL(CFHostStartInfoResolution)
+        self.assertArgIsOut(CFHostStartInfoResolution, 2)
         ok, error = CFHostStartInfoResolution(v, kCFHostAddresses, None)
-        self.failUnless(ok is True)
-        self.failUnlessIsInstance(error, CFStreamError)
+        self.assertIsObject(ok, True)
+        self.assertIsInstance(error, CFStreamError)
 
-        self.failUnlessResultIsCFRetained(CFHostCreateCopy)
+        self.assertResultIsCFRetained(CFHostCreateCopy)
         w = CFHostCreateCopy(None, v)
-        self.failUnlessIsInstance(w, (type(None), CFHostRef))
+        self.assertIsInstance(w, (type(None), CFHostRef))
         
 
-        self.failUnlessArgHasType(CFHostGetReachability, 1, 'o^' + objc._C_NSBOOL)
+        self.assertArgHasType(CFHostGetReachability, 1, b'o^' + objc._C_NSBOOL)
         lst, ok = CFHostGetReachability(v, None)
-        self.failUnlessIsInstance(lst, (CFDataRef, type(None)))
-        self.failUnlessIsInstance(ok, bool)
+        self.assertIsInstance(lst, (CFDataRef, type(None)))
+        self.assertIsInstance(ok, bool)
 
         CFHostCancelInfoResolution(v, kCFHostAddresses)
 
         CFHostUnscheduleFromRunLoop(v, rl, kCFRunLoopDefaultMode)
 
 
-        self.failUnlessArgHasType(CFHostGetNames, 1, 'o^' + objc._C_NSBOOL)
+        self.assertArgHasType(CFHostGetNames, 1, b'o^' + objc._C_NSBOOL)
         lst, ok = CFHostGetNames(v, None)
-        self.failUnlessIsInstance(lst, CFArrayRef)
-        self.failUnlessIsInstance(ok, bool)
+        self.assertIsInstance(lst, CFArrayRef)
+        self.assertIsInstance(ok, bool)
 
         
     def testCallbacks(self):
         CFHostScheduleWithRunLoop(host, rl, kCFRunLoopDefaultMode)
 
         ok, err = CFHostStartInfoResolution(host, kCFHostAddresses, None)
-        self.failUnless(ok)
-        self.failUnlessIsInstance(ok, bool)
-        self.failUnlessIsInstance(err, CFStreamError)
+        self.assertTrue(ok)
+        self.assertIsInstance(ok, bool)
+        self.assertIsInstance(err, CFStreamError)
 
         CFRunLoopRunInMode(kCFRunLoopDefaultMode, 4.0, True)
 
         CFHostUnscheduleFromRunLoop(host, rl, kCFRunLoopDefaultMode)
-        self.failUnlessEqual(len(lst), 1)
-        self.failUnlessIsInstance(lst[0][0], CFHostRef)
-        self.failUnlessIsInstance(lst[0][1], (int, long))
-        self.failUnlessIsInstance(lst[0][2], CFStreamError)
-        self.failUnless(lst[0][3] is ctx)
+        self.assertEqual(len(lst), 1)
+        self.assertIsInstance(lst[0][0], CFHostRef)
+        self.assertIsInstance(lst[0][1], (int, long))
+        self.assertIsInstance(lst[0][2], CFStreamError)
+        self.assertIsObject(lst[0][3], ctx)
 
         self.failIfResultIsCFRetained(CFHostGetAddressing)
-        self.failUnlessArgHasType(CFHostGetAddressing, 1, 'o^Z')
+        self.assertArgHasType(CFHostGetAddressing, 1, b'o^Z')
         lst, ok = CFHostGetAddressing(host, None)
-        self.failUnlessIsInstance(lst, CFArrayRef)
-        self.failUnlessIsInstance(lst[0], CFDataRef)
-        self.failUnlessIsInstance(ok, bool)
+        self.assertIsInstance(lst, CFArrayRef)
+        self.assertIsInstance(lst[0], CFDataRef)
+        self.assertIsInstance(ok, bool)
 
 
 if __name__ == "__main__":

File pyobjc-framework-CFNetwork/PyObjCTest/test_cfhttpauthentication.py

 class TestCFFTPStream (TestCase):
 
     def testTypes(self):
-        self.failUnlessIsCFType(CFHTTPAuthenticationRef)
+        self.assertIsCFType(CFHTTPAuthenticationRef)
 
     def testConstants(self):
-        self.failUnlessEqual(kCFStreamErrorHTTPAuthenticationTypeUnsupported, -1000)
-        self.failUnlessEqual(kCFStreamErrorHTTPAuthenticationBadUserName, -1001)
-        self.failUnlessEqual(kCFStreamErrorHTTPAuthenticationBadPassword, -1002)
+        self.assertEqual(kCFStreamErrorHTTPAuthenticationTypeUnsupported, -1000)
+        self.assertEqual(kCFStreamErrorHTTPAuthenticationBadUserName, -1001)
+        self.assertEqual(kCFStreamErrorHTTPAuthenticationBadPassword, -1002)
 
-        self.failUnlessIsInstance(kCFHTTPAuthenticationUsername, unicode)
-        self.failUnlessIsInstance(kCFHTTPAuthenticationPassword, unicode)
-        self.failUnlessIsInstance(kCFHTTPAuthenticationAccountDomain, unicode)
+        self.assertIsInstance(kCFHTTPAuthenticationUsername, unicode)
+        self.assertIsInstance(kCFHTTPAuthenticationPassword, unicode)
+        self.assertIsInstance(kCFHTTPAuthenticationAccountDomain, unicode)
 
     @min_os_level('10.5')
     #These functions should work on 10.4 as well, but caue a crash in CFNetwork on that platform
     def testFunctions(self):
-        self.failUnlessIsInstance(CFHTTPAuthenticationGetTypeID(), (int, long))
+        self.assertIsInstance(CFHTTPAuthenticationGetTypeID(), (int, long))
 
         msg = CFHTTPMessageCreateResponse(None, 401, "Authenticate", kCFHTTPVersion1_0)
-        self.failUnlessIsInstance(msg, CFHTTPMessageRef)
+        self.assertIsInstance(msg, CFHTTPMessageRef)
         CFHTTPMessageSetHeaderFieldValue(msg, NSString.stringWithString_('WWW-Authenticate'), NSString.stringWithString_('Basic realm="WallyWorld"'))
 
-        self.failUnlessResultIsCFRetained(CFHTTPAuthenticationCreateFromResponse)
+        self.assertResultIsCFRetained(CFHTTPAuthenticationCreateFromResponse)
         ref = CFHTTPAuthenticationCreateFromResponse(None, msg)
-        self.failUnlessIsInstance(ref, CFHTTPAuthenticationRef)
+        self.assertIsInstance(ref, CFHTTPAuthenticationRef)
 
-        self.failUnlessResultIsBOOL(CFHTTPAuthenticationIsValid)
-        self.failUnlessArgIsOut(CFHTTPAuthenticationIsValid, 1)
+        self.assertResultIsBOOL(CFHTTPAuthenticationIsValid)
+        self.assertArgIsOut(CFHTTPAuthenticationIsValid, 1)
         v, err = CFHTTPAuthenticationIsValid(ref, None)
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
         if v:
-            self.failUnless(err is None)
+            self.assertTrue(err is None)
         else:
-            self.failUnlessIsInstance(err, CFStreamError)
+            self.assertIsInstance(err, CFStreamError)
 
-        self.failUnlessResultIsBOOL(CFHTTPAuthenticationAppliesToRequest)
+        self.assertResultIsBOOL(CFHTTPAuthenticationAppliesToRequest)
         v = CFHTTPAuthenticationAppliesToRequest(ref, msg)
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
-        self.failUnlessResultIsBOOL(CFHTTPAuthenticationRequiresOrderedRequests)
+        self.assertResultIsBOOL(CFHTTPAuthenticationRequiresOrderedRequests)
         v = CFHTTPAuthenticationRequiresOrderedRequests(ref)
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
         url = CFURLCreateWithString(None, "http://www.python.org/", None)
         req = CFHTTPMessageCreateRequest(None, "GET", url, "1.0")
 
-        self.failUnlessResultIsBOOL(CFHTTPMessageApplyCredentials)
-        self.failUnlessArgIsOut(CFHTTPMessageApplyCredentials, 4)
+        self.assertResultIsBOOL(CFHTTPMessageApplyCredentials)
+        self.assertArgIsOut(CFHTTPMessageApplyCredentials, 4)
         v, err = CFHTTPMessageApplyCredentials(req, ref, "ronald", "secret", None)
         if v is True:
-            self.failUnlessEqual(err, None)
+            self.assertEqual(err, None)
 
         else:
-            self.failUnlessIsInstance(err, CFStreamError)
+            self.assertIsInstance(err, CFStreamError)
 
-        self.failUnlessResultIsBOOL(CFHTTPMessageApplyCredentialDictionary)
-        self.failUnlessArgIsOut(CFHTTPMessageApplyCredentialDictionary, 3)
+        self.assertResultIsBOOL(CFHTTPMessageApplyCredentialDictionary)
+        self.assertArgIsOut(CFHTTPMessageApplyCredentialDictionary, 3)
         v, err = CFHTTPMessageApplyCredentialDictionary(req, ref, {
                 kCFHTTPAuthenticationUsername: 'ronald',
                 kCFHTTPAuthenticationPassword: 'secret',
             }, None)
         if v is True:
-            self.failUnlessEqual(err, None)
+            self.assertEqual(err, None)
         else:
-            self.failUnlessIsInstance(err, CFStreamError)
+            self.assertIsInstance(err, CFStreamError)
 
-        self.failUnlessResultIsCFRetained(CFHTTPAuthenticationCopyRealm)
-        self.failUnlessResultHasType(CFHTTPAuthenticationCopyRealm, '^{__CFString=}')
+        self.assertResultIsCFRetained(CFHTTPAuthenticationCopyRealm)
+        self.assertResultHasType(CFHTTPAuthenticationCopyRealm, b'^{__CFString=}')
         v = CFHTTPAuthenticationCopyRealm(ref)
-        self.failUnless(v is None or isinstance(v, unicode))
+        self.assertTrue(v is None or isinstance(v, unicode))
 
-        self.failUnlessResultIsCFRetained(CFHTTPAuthenticationCopyDomains)
-        self.failUnlessResultHasType(CFHTTPAuthenticationCopyDomains, '^{__CFArray=}')
+        self.assertResultIsCFRetained(CFHTTPAuthenticationCopyDomains)
+        self.assertResultHasType(CFHTTPAuthenticationCopyDomains, b'^{__CFArray=}')
         v = CFHTTPAuthenticationCopyDomains(ref)
-        self.failUnless(v is None or isinstance(v, CFArrayRef))
+        self.assertTrue(v is None or isinstance(v, CFArrayRef))
 
-        self.failUnlessResultIsCFRetained(CFHTTPAuthenticationCopyMethod)
-        self.failUnlessResultHasType(CFHTTPAuthenticationCopyMethod, '^{__CFString=}')
+        self.assertResultIsCFRetained(CFHTTPAuthenticationCopyMethod)
+        self.assertResultHasType(CFHTTPAuthenticationCopyMethod, b'^{__CFString=}')
         v = CFHTTPAuthenticationCopyMethod(ref)
-        self.failUnless(v is None or isinstance(v, unicode))
+        self.assertTrue(v is None or isinstance(v, unicode))
 
-        self.failUnlessResultIsBOOL(CFHTTPAuthenticationRequiresUserNameAndPassword)
+        self.assertResultIsBOOL(CFHTTPAuthenticationRequiresUserNameAndPassword)
         v = CFHTTPAuthenticationRequiresUserNameAndPassword(ref)
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
-        self.failUnlessResultIsBOOL(CFHTTPAuthenticationRequiresAccountDomain)
+        self.assertResultIsBOOL(CFHTTPAuthenticationRequiresAccountDomain)
         v = CFHTTPAuthenticationRequiresAccountDomain(ref)
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
 
 

File pyobjc-framework-CFNetwork/PyObjCTest/test_cfhttpmessage.py

 from CFNetwork import *
 from PyObjCTools.TestSupport import *
+import sys
+
+if sys.version_info[0] != 2:
+    def buffer(value):
+        return value.encode('latin1')
 
 class TestCFHTTPMessage (TestCase):
 
     @min_os_level('10.5')
     def testConstants10_5(self):
-        self.failUnlessIsInstance(kCFHTTPAuthenticationSchemeNTLM, unicode)
-        self.failUnlessIsInstance(kCFHTTPAuthenticationSchemeNegotiate, unicode)
+        self.assertIsInstance(kCFHTTPAuthenticationSchemeNTLM, unicode)
+        self.assertIsInstance(kCFHTTPAuthenticationSchemeNegotiate, unicode)
 
     def testConstants(self):
-        self.failUnlessIsInstance(kCFHTTPVersion1_0, unicode)
-        self.failUnlessIsInstance(kCFHTTPVersion1_1, unicode)
-        self.failUnlessIsInstance(kCFHTTPAuthenticationSchemeBasic, unicode)
-        self.failUnlessIsInstance(kCFHTTPAuthenticationSchemeDigest, unicode)
+        self.assertIsInstance(kCFHTTPVersion1_0, unicode)
+        self.assertIsInstance(kCFHTTPVersion1_1, unicode)
+        self.assertIsInstance(kCFHTTPAuthenticationSchemeBasic, unicode)
+        self.assertIsInstance(kCFHTTPAuthenticationSchemeDigest, unicode)
 
     def testTypes(self):
-        self.failUnlessIsCFType(CFHTTPMessageRef)
+        self.assertIsCFType(CFHTTPMessageRef)
 
     def testFunctions(self):
-        self.failUnlessIsInstance(CFHTTPMessageGetTypeID(), (int, long))
+        self.assertIsInstance(CFHTTPMessageGetTypeID(), (int, long))
 
         url = CFURLCreateWithString(None, "http://www.python.org/", None)
-        self.failUnlessIsInstance(url, CFURLRef)
+        self.assertIsInstance(url, CFURLRef)
 
-        self.failUnlessResultIsCFRetained(CFHTTPMessageCreateRequest)
+        self.assertResultIsCFRetained(CFHTTPMessageCreateRequest)
         req = CFHTTPMessageCreateRequest(None, "GET", url, kCFHTTPVersion1_1)
-        self.failUnlessIsInstance(req, CFHTTPMessageRef)
+        self.assertIsInstance(req, CFHTTPMessageRef)
 
-        self.failUnlessResultIsCFRetained(CFHTTPMessageCreateResponse)
+        self.assertResultIsCFRetained(CFHTTPMessageCreateResponse)
         resp = CFHTTPMessageCreateResponse(None, 200, "Okidoki", kCFHTTPVersion1_1)
-        self.failUnlessIsInstance(req, CFHTTPMessageRef)
+        self.assertIsInstance(req, CFHTTPMessageRef)
         
-        self.failUnlessResultIsCFRetained(CFHTTPMessageCreateEmpty)
-        self.failUnlessArgIsBOOL(CFHTTPMessageCreateEmpty, 1)
+        self.assertResultIsCFRetained(CFHTTPMessageCreateEmpty)
+        self.assertArgIsBOOL(CFHTTPMessageCreateEmpty, 1)
         m = CFHTTPMessageCreateEmpty(None, True)
-        self.failUnlessIsInstance(m, CFHTTPMessageRef)
+        self.assertIsInstance(m, CFHTTPMessageRef)
 
-        self.failUnlessResultIsCFRetained(CFHTTPMessageCreateCopy)
+        self.assertResultIsCFRetained(CFHTTPMessageCreateCopy)
         m = CFHTTPMessageCreateCopy(None, req)
-        self.failUnlessIsInstance(m, CFHTTPMessageRef)
+        self.assertIsInstance(m, CFHTTPMessageRef)
 
-        self.failUnlessResultIsBOOL(CFHTTPMessageIsRequest)
-        self.failUnless(CFHTTPMessageIsRequest(req) is True)
-        self.failUnless(CFHTTPMessageIsRequest(resp) is False)
+        self.assertResultIsBOOL(CFHTTPMessageIsRequest)
+        self.assertTrue(CFHTTPMessageIsRequest(req) is True)
+        self.assertTrue(CFHTTPMessageIsRequest(resp) is False)
 
-        self.failUnlessResultIsCFRetained(CFHTTPMessageCopyVersion)
+        self.assertResultIsCFRetained(CFHTTPMessageCopyVersion)
         v = CFHTTPMessageCopyVersion(req)
-        self.failUnlessIsInstance(v, unicode)
+        self.assertIsInstance(v, unicode)
 
         CFHTTPMessageSetBody(req, buffer("hello world"))
 
-        self.failUnlessResultIsCFRetained(CFHTTPMessageCopyBody)
+        self.assertResultIsCFRetained(CFHTTPMessageCopyBody)
         b = CFHTTPMessageCopyBody(req)
-        self.failUnlessIsInstance(b, (CFDataRef, buffer))
+        if sys.version_info[0] == 2:
+            self.assertIsInstance(b, (CFDataRef, buffer))
+        else:
+            self.assertIsInstance(b, (CFDataRef, memoryview, bytes))
 
-        self.failUnlessResultIsCFRetained(CFHTTPMessageCopyAllHeaderFields)
+        self.assertResultIsCFRetained(CFHTTPMessageCopyAllHeaderFields)
         v = CFHTTPMessageCopyAllHeaderFields(req)
-        self.failUnlessIsInstance(v, CFDictionaryRef)
+        self.assertIsInstance(v, CFDictionaryRef)
 
-        self.failUnlessResultIsCFRetained(CFHTTPMessageCopyHeaderFieldValue)
+        self.assertResultIsCFRetained(CFHTTPMessageCopyHeaderFieldValue)
         v = CFHTTPMessageCopyHeaderFieldValue(req, u"X-Python")
-        self.failUnless(v is None)
+        self.assertTrue(v is None)
 
         CFHTTPMessageSetHeaderFieldValue(req, u"X-Python", u"Rocks")
         v = CFHTTPMessageCopyHeaderFieldValue(req, u"X-Python")
-        self.failUnlessEqual(v, u"Rocks")
+        self.assertEqual(v, u"Rocks")
 
-        self.failUnlessResultIsBOOL(CFHTTPMessageAppendBytes)
-        self.failUnlessArgHasType(CFHTTPMessageAppendBytes, 1, 'n^v')
-        self.failUnlessArgSizeInArg(CFHTTPMessageAppendBytes, 1, 2)
+        self.assertResultIsBOOL(CFHTTPMessageAppendBytes)
+        self.assertArgHasType(CFHTTPMessageAppendBytes, 1, b'n^v')
+        self.assertArgSizeInArg(CFHTTPMessageAppendBytes, 1, 2)
 
-        v = CFHTTPMessageAppendBytes(req, "hello world", 11)
-        self.failUnless(v is True)
+        v = CFHTTPMessageAppendBytes(req, b"hello world", 11)
+        self.assertTrue(v is True)
 
 
-        self.failUnlessResultIsBOOL(CFHTTPMessageIsHeaderComplete)
+        self.assertResultIsBOOL(CFHTTPMessageIsHeaderComplete)
         v = CFHTTPMessageIsHeaderComplete(req)
-        self.failUnless(v is False)
+        self.assertTrue(v is False)
 
-        self.failUnlessResultIsCFRetained(CFHTTPMessageCopySerializedMessage)
+        self.assertResultIsCFRetained(CFHTTPMessageCopySerializedMessage)
         v = CFHTTPMessageCopySerializedMessage(resp)
-        self.failUnlessIsInstance(v, CFDataRef)
+        self.assertIsInstance(v, CFDataRef)
 
-        self.failUnlessResultIsCFRetained(CFHTTPMessageCopyRequestURL)
+        self.assertResultIsCFRetained(CFHTTPMessageCopyRequestURL)
         v = CFHTTPMessageCopyRequestURL(req)
-        self.failUnlessIsInstance(v, CFURLRef)
+        self.assertIsInstance(v, CFURLRef)
 
-        self.failUnlessResultIsCFRetained(CFHTTPMessageCopyRequestMethod)
+        self.assertResultIsCFRetained(CFHTTPMessageCopyRequestMethod)
         v = CFHTTPMessageCopyRequestMethod(req)
-        self.failUnlessIsInstance(v, unicode)
+        self.assertIsInstance(v, unicode)
 
-        self.failUnlessResultIsBOOL(CFHTTPMessageAddAuthentication)
-        self.failUnlessArgIsBOOL(CFHTTPMessageAddAuthentication, 5)
+        self.assertResultIsBOOL(CFHTTPMessageAddAuthentication)
+        self.assertArgIsBOOL(CFHTTPMessageAddAuthentication, 5)
         v = CFHTTPMessageAddAuthentication(req, resp, u"ronald", u"secret", kCFHTTPAuthenticationSchemeBasic, False)
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
         v = CFHTTPMessageGetResponseStatusCode(resp)
-        self.failUnlessIsInstance(v, (int, long))
+        self.assertIsInstance(v, (int, long))
 
-        self.failUnlessResultIsCFRetained(CFHTTPMessageCopyResponseStatusLine)
+        self.assertResultIsCFRetained(CFHTTPMessageCopyResponseStatusLine)
         v = CFHTTPMessageCopyResponseStatusLine(resp)
-        self.failUnlessIsInstance(v, unicode)
+        self.assertIsInstance(v, unicode)
 
 
 if __name__ == "__main__":

File pyobjc-framework-CFNetwork/PyObjCTest/test_cfhttpstream.py

 class TestCFHTTPStream (TestCase):
     @min_os_level('10.5')
     def testConstants10_5(self):
-        self.failUnlessIsInstance(kCFStreamPropertyHTTPFinalRequest, unicode)
+        self.assertIsInstance(kCFStreamPropertyHTTPFinalRequest, unicode)
 
     def testConstants(self):
-        self.failUnlessEqual(kCFStreamErrorHTTPParseFailure, -1)
-        self.failUnlessEqual(kCFStreamErrorHTTPRedirectionLoop, -2)
-        self.failUnlessEqual(kCFStreamErrorHTTPBadURL, -3)
+        self.assertEqual(kCFStreamErrorHTTPParseFailure, -1)
+        self.assertEqual(kCFStreamErrorHTTPRedirectionLoop, -2)
+        self.assertEqual(kCFStreamErrorHTTPBadURL, -3)
 
-        self.failUnlessIsInstance(kCFStreamPropertyHTTPResponseHeader, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertyHTTPFinalURL, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertyHTTPProxy, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertyHTTPProxyHost, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertyHTTPProxyPort, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertyHTTPSProxyHost, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertyHTTPSProxyPort, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertyHTTPShouldAutoredirect, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertyHTTPAttemptPersistentConnection, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertyHTTPRequestBytesWrittenCount, unicode)
+        self.assertIsInstance(kCFStreamPropertyHTTPResponseHeader, unicode)
+        self.assertIsInstance(kCFStreamPropertyHTTPFinalURL, unicode)
+        self.assertIsInstance(kCFStreamPropertyHTTPProxy, unicode)
+        self.assertIsInstance(kCFStreamPropertyHTTPProxyHost, unicode)
+        self.assertIsInstance(kCFStreamPropertyHTTPProxyPort, unicode)
+        self.assertIsInstance(kCFStreamPropertyHTTPSProxyHost, unicode)
+        self.assertIsInstance(kCFStreamPropertyHTTPSProxyPort, unicode)
+        self.assertIsInstance(kCFStreamPropertyHTTPShouldAutoredirect, unicode)
+        self.assertIsInstance(kCFStreamPropertyHTTPAttemptPersistentConnection, unicode)
+        self.assertIsInstance(kCFStreamPropertyHTTPRequestBytesWrittenCount, unicode)
 
     def testFunctions(self):
        url = CFURLCreateWithString(None, "http://www.python.org/", None)
-       self.failUnlessIsInstance(url, CFURLRef)
+       self.assertIsInstance(url, CFURLRef)
 
        req = CFHTTPMessageCreateRequest(None, "GET", url, kCFHTTPVersion1_1)
-       self.failUnlessIsInstance(req, CFHTTPMessageRef)
+       self.assertIsInstance(req, CFHTTPMessageRef)
 
-       self.failUnlessResultIsCFRetained(CFReadStreamCreateForHTTPRequest)
+       self.assertResultIsCFRetained(CFReadStreamCreateForHTTPRequest)
        v = CFReadStreamCreateForHTTPRequest(None, req)
-       self.failUnlessIsInstance(v, CFReadStreamRef)
+       self.assertIsInstance(v, CFReadStreamRef)
 
        fp = open("/dev/null", "w")
        fd_2 = os.dup(2)
        try:
            # Avoid deprecation messages from CFNetwork
 
-           self.failUnlessResultIsCFRetained(CFReadStreamCreateForStreamedHTTPRequest)
+           self.assertResultIsCFRetained(CFReadStreamCreateForStreamedHTTPRequest)
            v = CFReadStreamCreateForStreamedHTTPRequest(None, req, v)
-           self.failUnlessIsInstance(v, CFReadStreamRef)
+           self.assertIsInstance(v, CFReadStreamRef)
 
-           self.failUnlessArgIsBOOL(CFHTTPReadStreamSetRedirectsAutomatically, 1)
+           self.assertArgIsBOOL(CFHTTPReadStreamSetRedirectsAutomatically, 1)
            CFHTTPReadStreamSetRedirectsAutomatically(v, True)
 
            CFHTTPReadStreamSetProxy(v, u"localhost", 8080)

File pyobjc-framework-CFNetwork/PyObjCTest/test_cfnetservices.py

 
 class TestCFNetServices (TestCase):
     def testTypes(self):
-        self.failUnlessIsCFType(CFNetServiceRef)
-        self.failUnlessIsCFType(CFNetServiceMonitorRef)
-        self.failUnlessIsCFType(CFNetServiceBrowserRef)
+        self.assertIsCFType(CFNetServiceRef)
+        self.assertIsCFType(CFNetServiceMonitorRef)
+        self.assertIsCFType(CFNetServiceBrowserRef)
 
     def testConstants(self):
-        self.failUnlessIsInstance(kCFStreamErrorDomainMach, (int, long))
-        self.failUnlessIsInstance(kCFStreamErrorDomainNetServices, (int, long))
+        self.assertIsInstance(kCFStreamErrorDomainMach, (int, long))
+        self.assertIsInstance(kCFStreamErrorDomainNetServices, (int, long))
 
-        self.failUnlessEqual(kCFNetServicesErrorUnknown, -72000)
-        self.failUnlessEqual(kCFNetServicesErrorCollision, -72001)
-        self.failUnlessEqual(kCFNetServicesErrorNotFound, -72002)
-        self.failUnlessEqual(kCFNetServicesErrorInProgress, -72003)
-        self.failUnlessEqual(kCFNetServicesErrorBadArgument, -72004)
-        self.failUnlessEqual(kCFNetServicesErrorCancel, -72005)
-        self.failUnlessEqual(kCFNetServicesErrorInvalid, -72006)
-        self.failUnlessEqual(kCFNetServicesErrorTimeout, -72007)
-        self.failUnlessEqual(kCFNetServiceMonitorTXT, 1)
-        self.failUnlessEqual(kCFNetServiceFlagNoAutoRename, 1)
-        self.failUnlessEqual(kCFNetServiceFlagMoreComing, 1)
-        self.failUnlessEqual(kCFNetServiceFlagIsDomain, 2)
-        self.failUnlessEqual(kCFNetServiceFlagIsDefault, 4)
-        self.failUnlessEqual(kCFNetServiceFlagIsRegistrationDomain, 4)
-        self.failUnlessEqual(kCFNetServiceFlagRemove, 8)
+        self.assertEqual(kCFNetServicesErrorUnknown, -72000)
+        self.assertEqual(kCFNetServicesErrorCollision, -72001)
+        self.assertEqual(kCFNetServicesErrorNotFound, -72002)
+        self.assertEqual(kCFNetServicesErrorInProgress, -72003)
+        self.assertEqual(kCFNetServicesErrorBadArgument, -72004)
+        self.assertEqual(kCFNetServicesErrorCancel, -72005)
+        self.assertEqual(kCFNetServicesErrorInvalid, -72006)
+        self.assertEqual(kCFNetServicesErrorTimeout, -72007)
+        self.assertEqual(kCFNetServiceMonitorTXT, 1)
+        self.assertEqual(kCFNetServiceFlagNoAutoRename, 1)
+        self.assertEqual(kCFNetServiceFlagMoreComing, 1)
+        self.assertEqual(kCFNetServiceFlagIsDomain, 2)
+        self.assertEqual(kCFNetServiceFlagIsDefault, 4)
+        self.assertEqual(kCFNetServiceFlagIsRegistrationDomain, 4)
+        self.assertEqual(kCFNetServiceFlagRemove, 8)
 
     def testFunctions(self):
-        self.failUnlessIsInstance(CFNetServiceGetTypeID(), (int, long))
-        self.failUnlessIsInstance(CFNetServiceMonitorGetTypeID(), (int, long))
-        self.failUnlessIsInstance(CFNetServiceBrowserGetTypeID(), (int, long))
+        self.assertIsInstance(CFNetServiceGetTypeID(), (int, long))
+        self.assertIsInstance(CFNetServiceMonitorGetTypeID(), (int, long))
+        self.assertIsInstance(CFNetServiceBrowserGetTypeID(), (int, long))
 
-        self.failUnlessResultIsCFRetained(CFNetServiceCreate)
+        self.assertResultIsCFRetained(CFNetServiceCreate)
         serv = CFNetServiceCreate(None, u"pyobjc.local", u"ssh", u"pyobjc.test.local", 9999)
-        self.failUnlessIsInstance(serv, CFNetServiceRef)
+        self.assertIsInstance(serv, CFNetServiceRef)
 
-        self.failUnlessResultIsCFRetained(CFNetServiceCreateCopy)
+        self.assertResultIsCFRetained(CFNetServiceCreateCopy)
         v = CFNetServiceCreateCopy(None, serv)
-        self.failUnlessIsInstance(v, CFNetServiceRef)
+        self.assertIsInstance(v, CFNetServiceRef)
 
         dom = CFNetServiceGetDomain(serv)
-        self.failUnlessIsInstance(dom, unicode)
+        self.assertIsInstance(dom, unicode)
 
         dom = CFNetServiceGetType(serv)
-        self.failUnlessIsInstance(dom, unicode)
+        self.assertIsInstance(dom, unicode)
 
         dom = CFNetServiceGetName(serv)
-        self.failUnlessIsInstance(dom, unicode)
+        self.assertIsInstance(dom, unicode)
 
-        self.failUnlessResultIsBOOL(CFNetServiceRegisterWithOptions)
-        self.failUnlessArgIsOut(CFNetServiceRegisterWithOptions, 2)
+        self.assertResultIsBOOL(CFNetServiceRegisterWithOptions)
+        self.assertArgIsOut(CFNetServiceRegisterWithOptions, 2)
 
         ok, err = CFNetServiceRegisterWithOptions(serv, kCFNetServiceFlagNoAutoRename, None)
-        self.failUnlessIsInstance(ok, bool)
+        self.assertIsInstance(ok, bool)
         if ok:
-            self.failUnlessEqual(err, None)
+            self.assertEqual(err, None)
         else:
-            self.failUnlessIsInstance(err, CFStreamError)
+            self.assertIsInstance(err, CFStreamError)
 
 
 if __name__ == "__main__":

File pyobjc-framework-CFNetwork/PyObjCTest/test_cfnetworkdiagnostics.py

     def testTypes(self):
         # XXX: CFNetDiagnosticsRef is not actually a proper type
         # in Leopard, the result turns out to be a CFDictionaryRef...
-        #self.failUnlessIsCFType(CFNetDiagnosticRef)
+        #self.assertIsCFType(CFNetDiagnosticRef)
         pass
 
     def testConstants(self):
-        self.failUnlessEqual(kCFNetDiagnosticNoErr, 0)
-        self.failUnlessEqual(kCFNetDiagnosticErr, -66560)
-        self.failUnlessEqual(kCFNetDiagnosticConnectionUp, -66559)
-        self.failUnlessEqual(kCFNetDiagnosticConnectionIndeterminate, -66558)
-        self.failUnlessEqual(kCFNetDiagnosticConnectionDown, -66557)
+        self.assertEqual(kCFNetDiagnosticNoErr, 0)
+        self.assertEqual(kCFNetDiagnosticErr, -66560)
+        self.assertEqual(kCFNetDiagnosticConnectionUp, -66559)
+        self.assertEqual(kCFNetDiagnosticConnectionIndeterminate, -66558)
+        self.assertEqual(kCFNetDiagnosticConnectionDown, -66557)
 
 
     def testFuncdtions(self):
-        self.failUnlessResultIsCFRetained(CFNetDiagnosticCreateWithStreams)
+        self.assertResultIsCFRetained(CFNetDiagnosticCreateWithStreams)
 
         host = CFHostCreateWithName(None, u"www.apple.com")
         rd, wr = CFStreamCreatePairWithSocketToCFHost(None, host, 80, None, None)
-        self.failUnlessIsInstance(rd, CFReadStreamRef)
-        self.failUnlessIsInstance(wr, CFWriteStreamRef)
+        self.assertIsInstance(rd, CFReadStreamRef)
+        self.assertIsInstance(wr, CFWriteStreamRef)
 
         ref = CFNetDiagnosticCreateWithStreams(None, rd, wr)
-        self.failUnlessIsInstance(ref, objc.objc_object) #CFNetDiagnosticRef)
+        self.assertIsInstance(ref, objc.objc_object) #CFNetDiagnosticRef)
 
-        self.failUnlessResultIsCFRetained(CFNetDiagnosticCreateWithURL)
+        self.assertResultIsCFRetained(CFNetDiagnosticCreateWithURL)
         ref = CFNetDiagnosticCreateWithURL(None, CFURLCreateWithString(None, u"http://www.apple.com/", None))
-        self.failUnlessIsInstance(ref, objc.objc_object) #CFNetDiagnosticRef)
+        self.assertIsInstance(ref, objc.objc_object) #CFNetDiagnosticRef)
 
         CFNetDiagnosticSetName(ref, u"hello world")
 
         sts = CFNetDiagnosticDiagnoseProblemInteractively(ref)
-        self.failUnlessIsInstance(sts, (int, long))
+        self.assertIsInstance(sts, (int, long))
 
-        self.failUnlessArgIsOut(CFNetDiagnosticCopyNetworkStatusPassively, 1)
+        self.assertArgIsOut(CFNetDiagnosticCopyNetworkStatusPassively, 1)
         sts, descr = CFNetDiagnosticCopyNetworkStatusPassively(ref, None)
-        self.failUnlessIsInstance(sts, (int, long))
-        self.failUnlessIsInstance(descr, unicode)
+        self.assertIsInstance(sts, (int, long))
+        self.assertIsInstance(descr, unicode)
 
 if __name__ == "__main__":
     main()

File pyobjc-framework-CFNetwork/PyObjCTest/test_cfnetworkerrors.py

 
     @min_os_level('10.5')
     def testConstants10_5(self):
-        self.failUnlessIsInstance(kCFErrorDomainCFNetwork, unicode)
-        self.failUnlessIsInstance(kCFErrorDomainWinSock, unicode)
-        self.failUnlessIsInstance(kCFGetAddrInfoFailureKey, unicode)
-        self.failUnlessIsInstance(kCFSOCKSStatusCodeKey, unicode)
-        self.failUnlessIsInstance(kCFSOCKSVersionKey, unicode)
-        self.failUnlessIsInstance(kCFSOCKSNegotiationMethodKey, unicode)
-        self.failUnlessIsInstance(kCFDNSServiceFailureKey, unicode)
-        self.failUnlessIsInstance(kCFFTPStatusCodeKey, unicode)
+        self.assertIsInstance(kCFErrorDomainCFNetwork, unicode)
+        self.assertIsInstance(kCFErrorDomainWinSock, unicode)
+        self.assertIsInstance(kCFGetAddrInfoFailureKey, unicode)
+        self.assertIsInstance(kCFSOCKSStatusCodeKey, unicode)
+        self.assertIsInstance(kCFSOCKSVersionKey, unicode)
+        self.assertIsInstance(kCFSOCKSNegotiationMethodKey, unicode)
+        self.assertIsInstance(kCFDNSServiceFailureKey, unicode)
+        self.assertIsInstance(kCFFTPStatusCodeKey, unicode)
 
     @min_os_level('10.6')
     def testConstants10_6(self):
-        self.failUnlessEqual(kCFErrorPACFileAuth, 309)
-        self.failUnlessEqual(kCFErrorHTTPSProxyConnectionFailure, 310)
+        self.assertEqual(kCFErrorPACFileAuth, 309)
+        self.assertEqual(kCFErrorHTTPSProxyConnectionFailure, 310)
 
-        self.failUnlessEqual(kCFURLErrorUnknown, -998)
-        self.failUnlessEqual(kCFURLErrorCancelled, -999)
-        self.failUnlessEqual(kCFURLErrorBadURL, -1000)
-        self.failUnlessEqual(kCFURLErrorTimedOut, -1001)
-        self.failUnlessEqual(kCFURLErrorUnsupportedURL, -1002)
-        self.failUnlessEqual(kCFURLErrorCannotFindHost, -1003)
-        self.failUnlessEqual(kCFURLErrorCannotConnectToHost, -1004)
-        self.failUnlessEqual(kCFURLErrorNetworkConnectionLost, -1005)
-        self.failUnlessEqual(kCFURLErrorDNSLookupFailed, -1006)
-        self.failUnlessEqual(kCFURLErrorHTTPTooManyRedirects, -1007)
-        self.failUnlessEqual(kCFURLErrorResourceUnavailable, -1008)
-        self.failUnlessEqual(kCFURLErrorNotConnectedToInternet, -1009)
-        self.failUnlessEqual(kCFURLErrorRedirectToNonExistentLocation, -1010)
-        self.failUnlessEqual(kCFURLErrorBadServerResponse, -1011)
-        self.failUnlessEqual(kCFURLErrorUserCancelledAuthentication, -1012)
-        self.failUnlessEqual(kCFURLErrorUserAuthenticationRequired, -1013)
-        self.failUnlessEqual(kCFURLErrorZeroByteResource, -1014)
-        self.failUnlessEqual(kCFURLErrorCannotDecodeRawData, -1015)
-        self.failUnlessEqual(kCFURLErrorCannotDecodeContentData, -1016)
-        self.failUnlessEqual(kCFURLErrorCannotParseResponse, -1017)
-        self.failUnlessEqual(kCFURLErrorInternationalRoamingOff, -1018)
-        self.failUnlessEqual(kCFURLErrorCallIsActive, -1019)
-        self.failUnlessEqual(kCFURLErrorDataNotAllowed, -1020)
-        self.failUnlessEqual(kCFURLErrorRequestBodyStreamExhausted, -1021)
-        self.failUnlessEqual(kCFURLErrorFileDoesNotExist, -1100)
-        self.failUnlessEqual(kCFURLErrorFileIsDirectory, -1101)
-        self.failUnlessEqual(kCFURLErrorNoPermissionsToReadFile, -1102)
-        self.failUnlessEqual(kCFURLErrorDataLengthExceedsMaximum, -1103)
-        self.failUnlessEqual(kCFURLErrorSecureConnectionFailed, -1200)
-        self.failUnlessEqual(kCFURLErrorServerCertificateHasBadDate, -1201)
-        self.failUnlessEqual(kCFURLErrorServerCertificateUntrusted, -1202)
-        self.failUnlessEqual(kCFURLErrorServerCertificateHasUnknownRoot, -1203)
-        self.failUnlessEqual(kCFURLErrorServerCertificateNotYetValid, -1204)
-        self.failUnlessEqual(kCFURLErrorClientCertificateRejected, -1205)
-        self.failUnlessEqual(kCFURLErrorClientCertificateRequired, -1206)
-        self.failUnlessEqual(kCFURLErrorCannotLoadFromNetwork, -2000)
-        self.failUnlessEqual(kCFURLErrorCannotCreateFile, -3000)
-        self.failUnlessEqual(kCFURLErrorCannotOpenFile, -3001)
-        self.failUnlessEqual(kCFURLErrorCannotCloseFile, -3002)
-        self.failUnlessEqual(kCFURLErrorCannotWriteToFile, -3003)
-        self.failUnlessEqual(kCFURLErrorCannotRemoveFile, -3004)
-        self.failUnlessEqual(kCFURLErrorCannotMoveFile, -3005)
-        self.failUnlessEqual(kCFURLErrorDownloadDecodingFailedMidStream, -3006)
-        self.failUnlessEqual(kCFURLErrorDownloadDecodingFailedToComplete, -3007)
-        self.failUnlessEqual(kCFHTTPCookieCannotParseCookieFile, -4000)
+        self.assertEqual(kCFURLErrorUnknown, -998)
+        self.assertEqual(kCFURLErrorCancelled, -999)
+        self.assertEqual(kCFURLErrorBadURL, -1000)
+        self.assertEqual(kCFURLErrorTimedOut, -1001)
+        self.assertEqual(kCFURLErrorUnsupportedURL, -1002)
+        self.assertEqual(kCFURLErrorCannotFindHost, -1003)
+        self.assertEqual(kCFURLErrorCannotConnectToHost, -1004)
+        self.assertEqual(kCFURLErrorNetworkConnectionLost, -1005)
+        self.assertEqual(kCFURLErrorDNSLookupFailed, -1006)
+        self.assertEqual(kCFURLErrorHTTPTooManyRedirects, -1007)
+        self.assertEqual(kCFURLErrorResourceUnavailable, -1008)
+        self.assertEqual(kCFURLErrorNotConnectedToInternet, -1009)
+        self.assertEqual(kCFURLErrorRedirectToNonExistentLocation, -1010)
+        self.assertEqual(kCFURLErrorBadServerResponse, -1011)
+        self.assertEqual(kCFURLErrorUserCancelledAuthentication, -1012)
+        self.assertEqual(kCFURLErrorUserAuthenticationRequired, -1013)
+        self.assertEqual(kCFURLErrorZeroByteResource, -1014)
+        self.assertEqual(kCFURLErrorCannotDecodeRawData, -1015)
+        self.assertEqual(kCFURLErrorCannotDecodeContentData, -1016)
+        self.assertEqual(kCFURLErrorCannotParseResponse, -1017)
+        self.assertEqual(kCFURLErrorInternationalRoamingOff, -1018)
+        self.assertEqual(kCFURLErrorCallIsActive, -1019)
+        self.assertEqual(kCFURLErrorDataNotAllowed, -1020)
+        self.assertEqual(kCFURLErrorRequestBodyStreamExhausted, -1021)
+        self.assertEqual(kCFURLErrorFileDoesNotExist, -1100)
+        self.assertEqual(kCFURLErrorFileIsDirectory, -1101)
+        self.assertEqual(kCFURLErrorNoPermissionsToReadFile, -1102)
+        self.assertEqual(kCFURLErrorDataLengthExceedsMaximum, -1103)
+        self.assertEqual(kCFURLErrorSecureConnectionFailed, -1200)
+        self.assertEqual(kCFURLErrorServerCertificateHasBadDate, -1201)
+        self.assertEqual(kCFURLErrorServerCertificateUntrusted, -1202)
+        self.assertEqual(kCFURLErrorServerCertificateHasUnknownRoot, -1203)
+        self.assertEqual(kCFURLErrorServerCertificateNotYetValid, -1204)
+        self.assertEqual(kCFURLErrorClientCertificateRejected, -1205)
+        self.assertEqual(kCFURLErrorClientCertificateRequired, -1206)
+        self.assertEqual(kCFURLErrorCannotLoadFromNetwork, -2000)
+        self.assertEqual(kCFURLErrorCannotCreateFile, -3000)
+        self.assertEqual(kCFURLErrorCannotOpenFile, -3001)
+        self.assertEqual(kCFURLErrorCannotCloseFile, -3002)
+        self.assertEqual(kCFURLErrorCannotWriteToFile, -3003)
+        self.assertEqual(kCFURLErrorCannotRemoveFile, -3004)
+        self.assertEqual(kCFURLErrorCannotMoveFile, -3005)
+        self.assertEqual(kCFURLErrorDownloadDecodingFailedMidStream, -3006)
+        self.assertEqual(kCFURLErrorDownloadDecodingFailedToComplete, -3007)
+        self.assertEqual(kCFHTTPCookieCannotParseCookieFile, -4000)
 
-        self.failUnlessIsInstance(kCFURLErrorFailingURLErrorKey, unicode)
-        self.failUnlessIsInstance(kCFURLErrorFailingURLStringErrorKey, unicode)
+        self.assertIsInstance(kCFURLErrorFailingURLErrorKey, unicode)
+        self.assertIsInstance(kCFURLErrorFailingURLStringErrorKey, unicode)
 
 
     def testConstants(self):
-        self.failUnlessEqual(kCFHostErrorHostNotFound, 1)
-        self.failUnlessEqual(kCFHostErrorUnknown, 2)
-        self.failUnlessEqual(kCFSOCKSErrorUnknownClientVersion, 100)
-        self.failUnlessEqual(kCFSOCKSErrorUnsupportedServerVersion, 101)
-        self.failUnlessEqual(kCFSOCKS4ErrorRequestFailed, 110)
-        self.failUnlessEqual(kCFSOCKS4ErrorIdentdFailed, 111)
-        self.failUnlessEqual(kCFSOCKS4ErrorIdConflict, 112)
-        self.failUnlessEqual(kCFSOCKS4ErrorUnknownStatusCode, 113)
-        self.failUnlessEqual(kCFSOCKS5ErrorBadState, 120)
-        self.failUnlessEqual(kCFSOCKS5ErrorBadResponseAddr, 121)
-        self.failUnlessEqual(kCFSOCKS5ErrorBadCredentials, 122)
-        self.failUnlessEqual(kCFSOCKS5ErrorUnsupportedNegotiationMethod, 123)
-        self.failUnlessEqual(kCFSOCKS5ErrorNoAcceptableMethod, 124)
-        self.failUnlessEqual(kCFNetServiceErrorUnknown, -72000)
-        self.failUnlessEqual(kCFNetServiceErrorCollision, -72001)
-        self.failUnlessEqual(kCFNetServiceErrorNotFound, -72002)
-        self.failUnlessEqual(kCFNetServiceErrorInProgress, -72003)
-        self.failUnlessEqual(kCFNetServiceErrorBadArgument, -72004)
-        self.failUnlessEqual(kCFNetServiceErrorCancel, -72005)
-        self.failUnlessEqual(kCFNetServiceErrorInvalid, -72006)
-        self.failUnlessEqual(kCFNetServiceErrorTimeout, -72007)
-        self.failUnlessEqual(kCFNetServiceErrorDNSServiceFailure, -73000)
-        self.failUnlessEqual(kCFFTPErrorUnexpectedStatusCode, 200)
-        self.failUnlessEqual(kCFErrorHTTPAuthenticationTypeUnsupported, 300)
-        self.failUnlessEqual(kCFErrorHTTPBadCredentials, 301)
-        self.failUnlessEqual(kCFErrorHTTPConnectionLost, 302)
-        self.failUnlessEqual(kCFErrorHTTPParseFailure, 303)
-        self.failUnlessEqual(kCFErrorHTTPRedirectionLoopDetected, 304)
-        self.failUnlessEqual(kCFErrorHTTPBadURL, 305)
-        self.failUnlessEqual(kCFErrorHTTPProxyConnectionFailure, 306)
-        self.failUnlessEqual(kCFErrorHTTPBadProxyCredentials, 307)
-        self.failUnlessEqual(kCFErrorPACFileError, 308)
+        self.assertEqual(kCFHostErrorHostNotFound, 1)
+        self.assertEqual(kCFHostErrorUnknown, 2)
+        self.assertEqual(kCFSOCKSErrorUnknownClientVersion, 100)
+        self.assertEqual(kCFSOCKSErrorUnsupportedServerVersion, 101)
+        self.assertEqual(kCFSOCKS4ErrorRequestFailed, 110)
+        self.assertEqual(kCFSOCKS4ErrorIdentdFailed, 111)
+        self.assertEqual(kCFSOCKS4ErrorIdConflict, 112)
+        self.assertEqual(kCFSOCKS4ErrorUnknownStatusCode, 113)
+        self.assertEqual(kCFSOCKS5ErrorBadState, 120)
+        self.assertEqual(kCFSOCKS5ErrorBadResponseAddr, 121)
+        self.assertEqual(kCFSOCKS5ErrorBadCredentials, 122)
+        self.assertEqual(kCFSOCKS5ErrorUnsupportedNegotiationMethod, 123)
+        self.assertEqual(kCFSOCKS5ErrorNoAcceptableMethod, 124)
+        self.assertEqual(kCFNetServiceErrorUnknown, -72000)
+        self.assertEqual(kCFNetServiceErrorCollision, -72001)
+        self.assertEqual(kCFNetServiceErrorNotFound, -72002)
+        self.assertEqual(kCFNetServiceErrorInProgress, -72003)
+        self.assertEqual(kCFNetServiceErrorBadArgument, -72004)
+        self.assertEqual(kCFNetServiceErrorCancel, -72005)
+        self.assertEqual(kCFNetServiceErrorInvalid, -72006)
+        self.assertEqual(kCFNetServiceErrorTimeout, -72007)
+        self.assertEqual(kCFNetServiceErrorDNSServiceFailure, -73000)
+        self.assertEqual(kCFFTPErrorUnexpectedStatusCode, 200)
+        self.assertEqual(kCFErrorHTTPAuthenticationTypeUnsupported, 300)
+        self.assertEqual(kCFErrorHTTPBadCredentials, 301)
+        self.assertEqual(kCFErrorHTTPConnectionLost, 302)
+        self.assertEqual(kCFErrorHTTPParseFailure, 303)
+        self.assertEqual(kCFErrorHTTPRedirectionLoopDetected, 304)
+        self.assertEqual(kCFErrorHTTPBadURL, 305)
+        self.assertEqual(kCFErrorHTTPProxyConnectionFailure, 306)
+        self.assertEqual(kCFErrorHTTPBadProxyCredentials, 307)
+        self.assertEqual(kCFErrorPACFileError, 308)
 
 if __name__ == "__main__":
     main()

File pyobjc-framework-CFNetwork/PyObjCTest/test_cfproxysupport.py

 
     @min_os_level('10.5')
     def testFunctions(self):
-        self.failUnlessResultIsCFRetained(CFNetworkCopyProxiesForURL)
+        self.assertResultIsCFRetained(CFNetworkCopyProxiesForURL)
         url = CFURLCreateWithString(None, "http://www.apple.com/", None)
         v = CFNetworkCopyProxiesForURL(url, None)
-        self.failUnlessIsInstance(v, CFArrayRef)
+        self.assertIsInstance(v, CFArrayRef)
 
-        self.failUnlessResultIsCFRetained(CFNetworkCopyProxiesForAutoConfigurationScript)
-        self.failUnlessArgIsOut(CFNetworkCopyProxiesForAutoConfigurationScript, 2)
+        self.assertResultIsCFRetained(CFNetworkCopyProxiesForAutoConfigurationScript)
+        self.assertArgIsOut(CFNetworkCopyProxiesForAutoConfigurationScript, 2)
         v, err  = CFNetworkCopyProxiesForAutoConfigurationScript(
                 SCRIPT, url, None)
-        self.failUnless(err is None)
-        self.failUnlessIsInstance(v, CFArrayRef)
+        self.assertTrue(err is None)
+        self.assertIsInstance(v, CFArrayRef)
         x = v[0]
-        self.failUnlessEqual(x[kCFProxyTypeKey], kCFProxyTypeHTTP)
-        self.failUnlessEqual(x[kCFProxyHostNameKey], "proxy.apple.com")
-        self.failUnlessEqual(x[kCFProxyPortNumberKey], 8080)
+        self.assertEqual(x[kCFProxyTypeKey], kCFProxyTypeHTTP)
+        self.assertEqual(x[kCFProxyHostNameKey], "proxy.apple.com")
+        self.assertEqual(x[kCFProxyPortNumberKey], 8080)
 
-        self.failUnlessResultIsCFRetained(CFNetworkCopySystemProxySettings)
+        self.assertResultIsCFRetained(CFNetworkCopySystemProxySettings)
         v = CFNetworkCopySystemProxySettings()
-        self.failUnlessIsInstance(v, CFDictionaryRef)
+        self.assertIsInstance(v, CFDictionaryRef)
 
 
     @min_os_level('10.5')
         
         rls = CFNetworkExecuteProxyAutoConfigurationScript(
                 SCRIPT, url, callback, ctx)
-        self.failUnlessIsInstance(rls, CFRunLoopSourceRef)
+        self.assertIsInstance(rls, CFRunLoopSourceRef)
 
         rl = CFRunLoopGetCurrent()
         CFRunLoopAddSource(rl, rls,  kCFRunLoopCommonModes)
 
         CFRunLoopRemoveSource(rl, rls,  kCFRunLoopCommonModes)
 
-        self.failIfEqual(len(lst), 0)
-        self.failUnless(lst[0][0] is ctx)
-        self.failUnlessIsInstance(lst[0][1], CFArrayRef)
-        self.failUnlessEqual(lst[0][2],  None)
+        self.assertNotEqual(len(lst), 0)
+        self.assertTrue(lst[0][0] is ctx)
+        self.assertIsInstance(lst[0][1], CFArrayRef)
+        self.assertEqual(lst[0][2],  None)
 
         lst[:] = []
         path = os.path.join(os.path.dirname(__file__), "proxy.pac")
 
         rls = CFNetworkExecuteProxyAutoConfigurationURL(
                 scriptURL, url, callback, ctx)
-        self.failUnlessIsInstance(rls, CFRunLoopSourceRef)
+        self.assertIsInstance(rls, CFRunLoopSourceRef)
 
         CFRunLoopAddSource(rl, rls,  kCFRunLoopCommonModes)
 
 
         #print lst
 
-        self.failIfEqual(len(lst), 0)
-        self.failUnless(lst[0][0] is ctx)
+        self.assertNotEqual(len(lst), 0)
+        self.assertTrue(lst[0][0] is ctx)
         if lst[0][2] is None:
-            self.failUnlessIsInstance(lst[0][1], CFArrayRef)
-            self.failUnlessEqual(lst[0][2],  None)
+            self.assertIsInstance(lst[0][1], CFArrayRef)
+            self.assertEqual(lst[0][2],  None)
 
         else:
-            self.failUnlessEqual(lst[0][1],  None)
-            self.failUnlessIsInstance(lst[0][2], CFErrorRef)
+            self.assertEqual(lst[0][1],  None)
+            self.assertIsInstance(lst[0][2], CFErrorRef)
 
 
         
 
     @min_os_level('10.5')
     def testConstants(self):
-        self.failUnlessIsInstance(kCFProxyTypeKey, unicode)
-        self.failUnlessIsInstance(kCFProxyHostNameKey, unicode)
-        self.failUnlessIsInstance(kCFProxyPortNumberKey, unicode)
-        self.failUnlessIsInstance(kCFProxyAutoConfigurationURLKey, unicode)
-        self.failUnlessIsInstance(kCFProxyUsernameKey, unicode)
-        self.failUnlessIsInstance(kCFProxyPasswordKey, unicode)
-        self.failUnlessIsInstance(kCFProxyTypeNone, unicode)
-        self.failUnlessIsInstance(kCFProxyTypeHTTP, unicode)
-        self.failUnlessIsInstance(kCFProxyTypeHTTPS, unicode)
-        self.failUnlessIsInstance(kCFProxyTypeSOCKS, unicode)
-        self.failUnlessIsInstance(kCFProxyTypeFTP, unicode)
-        self.failUnlessIsInstance(kCFProxyTypeAutoConfigurationURL, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesHTTPEnable, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesHTTPPort, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesHTTPProxy, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesProxyAutoConfigEnable, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesProxyAutoConfigURLString, unicode)
+        self.assertIsInstance(kCFProxyTypeKey, unicode)
+        self.assertIsInstance(kCFProxyHostNameKey, unicode)
+        self.assertIsInstance(kCFProxyPortNumberKey, unicode)
+        self.assertIsInstance(kCFProxyAutoConfigurationURLKey, unicode)
+        self.assertIsInstance(kCFProxyUsernameKey, unicode)
+        self.assertIsInstance(kCFProxyPasswordKey, unicode)
+        self.assertIsInstance(kCFProxyTypeNone, unicode)
+        self.assertIsInstance(kCFProxyTypeHTTP, unicode)
+        self.assertIsInstance(kCFProxyTypeHTTPS, unicode)
+        self.assertIsInstance(kCFProxyTypeSOCKS, unicode)
+        self.assertIsInstance(kCFProxyTypeFTP, unicode)
+        self.assertIsInstance(kCFProxyTypeAutoConfigurationURL, unicode)
+        self.assertIsInstance(kCFNetworkProxiesHTTPEnable, unicode)
+        self.assertIsInstance(kCFNetworkProxiesHTTPPort, unicode)
+        self.assertIsInstance(kCFNetworkProxiesHTTPProxy, unicode)
+        self.assertIsInstance(kCFNetworkProxiesProxyAutoConfigEnable, unicode)
+        self.assertIsInstance(kCFNetworkProxiesProxyAutoConfigURLString, unicode)
 
     @expectedFailure
     @min_os_level('10.5')
     def testConstants_fail(self):
-        self.failUnlessIsInstance(kCFProxyAutoConfigurationHTTPResponseKey, unicode)
+        self.assertIsInstance(kCFProxyAutoConfigurationHTTPResponseKey, unicode)
 
     @min_os_level('10.6')
     def testFunctions10_6(self):
         r = CFNetworkCopySystemProxySettings()
-        self.failUnlessIsInstance(r, CFDictionaryRef)
+        self.assertIsInstance(r, CFDictionaryRef)
 
     @min_os_level('10.6')
     def testConstants10_6(self):
-        self.failUnlessIsInstance(kCFNetworkProxiesExceptionsList, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesExcludeSimpleHostnames, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesFTPEnable, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesFTPPassive, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesFTPPort, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesFTPProxy, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesGopherEnable, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesGopherPort, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesGopherProxy, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesHTTPSEnable, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesHTTPSPort, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesHTTPSProxy, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesRTSPEnable, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesRTSPPort, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesRTSPProxy, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesSOCKSEnable, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesSOCKSPort, unicode)
-        self.failUnlessIsInstance(kCFNetworkProxiesSOCKSProxy, unicode)
+        self.assertIsInstance(kCFNetworkProxiesExceptionsList, unicode)
+        self.assertIsInstance(kCFNetworkProxiesExcludeSimpleHostnames, unicode)
+        self.assertIsInstance(kCFNetworkProxiesFTPEnable, unicode)
+        self.assertIsInstance(kCFNetworkProxiesFTPPassive, unicode)
+        self.assertIsInstance(kCFNetworkProxiesFTPPort, unicode)
+        self.assertIsInstance(kCFNetworkProxiesFTPProxy, unicode)
+        self.assertIsInstance(kCFNetworkProxiesGopherEnable, unicode)
+        self.assertIsInstance(kCFNetworkProxiesGopherPort, unicode)
+        self.assertIsInstance(kCFNetworkProxiesGopherProxy, unicode)
+        self.assertIsInstance(kCFNetworkProxiesHTTPSEnable, unicode)
+        self.assertIsInstance(kCFNetworkProxiesHTTPSPort, unicode)
+        self.assertIsInstance(kCFNetworkProxiesHTTPSProxy, unicode)
+        self.assertIsInstance(kCFNetworkProxiesRTSPEnable, unicode)
+        self.assertIsInstance(kCFNetworkProxiesRTSPPort, unicode)
+        self.assertIsInstance(kCFNetworkProxiesRTSPProxy, unicode)
+        self.assertIsInstance(kCFNetworkProxiesSOCKSEnable, unicode)
+        self.assertIsInstance(kCFNetworkProxiesSOCKSPort, unicode)
+        self.assertIsInstance(kCFNetworkProxiesSOCKSProxy, unicode)
 
 
 

File pyobjc-framework-CFNetwork/PyObjCTest/test_cfsocketstream.py

 class TestCFSocketStream (TestCase):
     @min_os_level('10.5')
     def testConstants10_5(self):
-        self.failUnlessIsInstance(kCFStreamPropertySSLPeerTrust, unicode)
-        self.failUnlessIsInstance(kCFStreamErrorDomainWinSock, (int, long))
+        self.assertIsInstance(kCFStreamPropertySSLPeerTrust, unicode)
+        self.assertIsInstance(kCFStreamErrorDomainWinSock, (int, long))
 
     def testConstants(self):
-        self.failUnlessIsInstance(kCFStreamPropertySSLPeerCertificates, unicode)
+        self.assertIsInstance(kCFStreamPropertySSLPeerCertificates, unicode)
 
-        self.failUnlessIsInstance(kCFStreamPropertySSLPeerCertificates, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertySSLSettings, unicode)
-        self.failUnlessIsInstance(kCFStreamSSLLevel, unicode)
-        self.failUnlessIsInstance(kCFStreamSSLAllowsExpiredCertificates, unicode)
-        self.failUnlessIsInstance(kCFStreamSSLAllowsExpiredRoots, unicode)
-        self.failUnlessIsInstance(kCFStreamSSLAllowsAnyRoot, unicode)
-        self.failUnlessIsInstance(kCFStreamSSLValidatesCertificateChain, unicode)
-        self.failUnlessIsInstance(kCFStreamSSLPeerName, unicode)
-        self.failUnlessIsInstance(kCFStreamSSLCertificates, unicode)
-        self.failUnlessIsInstance(kCFStreamSSLIsServer, unicode)
-        self.failUnlessIsInstance(kCFStreamErrorDomainSOCKS, (int, long))
+        self.assertIsInstance(kCFStreamPropertySSLPeerCertificates, unicode)
+        self.assertIsInstance(kCFStreamPropertySSLSettings, unicode)
+        self.assertIsInstance(kCFStreamSSLLevel, unicode)
+        self.assertIsInstance(kCFStreamSSLAllowsExpiredCertificates, unicode)
+        self.assertIsInstance(kCFStreamSSLAllowsExpiredRoots, unicode)
+        self.assertIsInstance(kCFStreamSSLAllowsAnyRoot, unicode)
+        self.assertIsInstance(kCFStreamSSLValidatesCertificateChain, unicode)
+        self.assertIsInstance(kCFStreamSSLPeerName, unicode)
+        self.assertIsInstance(kCFStreamSSLCertificates, unicode)
+        self.assertIsInstance(kCFStreamSSLIsServer, unicode)
+        self.assertIsInstance(kCFStreamErrorDomainSOCKS, (int, long))
 
-        self.failUnlessEqual(kCFStreamErrorSOCKSSubDomainNone, 0)
-        self.failUnlessEqual(kCFStreamErrorSOCKSSubDomainVersionCode, 1)
-        self.failUnlessEqual(kCFStreamErrorSOCKS4SubDomainResponse, 2)
-        self.failUnlessEqual(kCFStreamErrorSOCKS5SubDomainUserPass, 3)
-        self.failUnlessEqual(kCFStreamErrorSOCKS5SubDomainMethod, 4)
-        self.failUnlessEqual(kCFStreamErrorSOCKS5SubDomainResponse, 5)
-        self.failUnlessEqual(kCFStreamErrorSOCKS5BadResponseAddr, 1)
-        self.failUnlessEqual(kCFStreamErrorSOCKS5BadState, 2)
-        self.failUnlessEqual(kCFStreamErrorSOCKSUnknownClientVersion, 3)
-        self.failUnlessEqual(kCFStreamErrorSOCKS4RequestFailed, 91)
-        self.failUnlessEqual(kCFStreamErrorSOCKS4IdentdFailed, 92)
-        self.failUnlessEqual(kCFStreamErrorSOCKS4IdConflict, 93)
-        self.failUnlessEqual(kSOCKS5NoAcceptableMethod, 0xFF)
+        self.assertEqual(kCFStreamErrorSOCKSSubDomainNone, 0)
+        self.assertEqual(kCFStreamErrorSOCKSSubDomainVersionCode, 1)
+        self.assertEqual(kCFStreamErrorSOCKS4SubDomainResponse, 2)
+        self.assertEqual(kCFStreamErrorSOCKS5SubDomainUserPass, 3)
+        self.assertEqual(kCFStreamErrorSOCKS5SubDomainMethod, 4)
+        self.assertEqual(kCFStreamErrorSOCKS5SubDomainResponse, 5)
+        self.assertEqual(kCFStreamErrorSOCKS5BadResponseAddr, 1)
+        self.assertEqual(kCFStreamErrorSOCKS5BadState, 2)
+        self.assertEqual(kCFStreamErrorSOCKSUnknownClientVersion, 3)
+        self.assertEqual(kCFStreamErrorSOCKS4RequestFailed, 91)
+        self.assertEqual(kCFStreamErrorSOCKS4IdentdFailed, 92)
+        self.assertEqual(kCFStreamErrorSOCKS4IdConflict, 93)
+        self.assertEqual(kSOCKS5NoAcceptableMethod, 0xFF)
 
-        self.failUnlessIsInstance(kCFStreamPropertySOCKSProxyHost, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertySOCKSProxyPort, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertySOCKSVersion, unicode)
-        self.failUnlessIsInstance(kCFStreamSocketSOCKSVersion4, unicode)
-        self.failUnlessIsInstance(kCFStreamSocketSOCKSVersion5, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertySOCKSUser, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertySOCKSPassword, unicode)
-        self.failUnlessIsInstance(kCFStreamErrorDomainSSL, (int, long))
-        self.failUnlessIsInstance(kCFStreamPropertySocketSecurityLevel, unicode)
-        self.failUnlessIsInstance(kCFStreamSocketSecurityLevelNone, unicode)
-        self.failUnlessIsInstance(kCFStreamSocketSecurityLevelSSLv2, unicode)
-        self.failUnlessIsInstance(kCFStreamSocketSecurityLevelSSLv3, unicode)
-        self.failUnlessIsInstance(kCFStreamSocketSecurityLevelTLSv1, unicode)
-        self.failUnlessIsInstance(kCFStreamSocketSecurityLevelNegotiatedSSL, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertyShouldCloseNativeSocket, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertySocketRemoteHost, unicode)
-        self.failUnlessIsInstance(kCFStreamPropertySocketRemoteNetService, unicode)
-        self.failUnlessEqual(kCFStreamSocketSecurityNone, 0)
-        self.failUnlessEqual(kCFStreamSocketSecuritySSLv2, 1)
-        self.failUnlessEqual(kCFStreamSocketSecuritySSLv3, 2)
-        self.failUnlessEqual(kCFStreamSocketSecuritySSLv23, 3)
-        self.failUnlessEqual(kCFStreamSocketSecurityTLSv1, 4)
+        self.assertIsInstance(kCFStreamPropertySOCKSProxyHost, unicode)
+        self.assertIsInstance(kCFStreamPropertySOCKSProxyPort, unicode)
+        self.assertIsInstance(kCFStreamPropertySOCKSVersion, unicode)
+        self.assertIsInstance(kCFStreamSocketSOCKSVersion4, unicode)
+        self.assertIsInstance(kCFStreamSocketSOCKSVersion5, unicode)
+        self.assertIsInstance(kCFStreamPropertySOCKSUser, unicode)
+        self.assertIsInstance(kCFStreamPropertySOCKSPassword, unicode)
+        self.assertIsInstance(kCFStreamErrorDomainSSL, (int, long))
+        self.assertIsInstance(kCFStreamPropertySocketSecurityLevel, unicode)
+        self.assertIsInstance(kCFStreamSocketSecurityLevelNone, unicode)
+        self.assertIsInstance(kCFStreamSocketSecurityLevelSSLv2, unicode)
+        self.assertIsInstance(kCFStreamSocketSecurityLevelSSLv3, unicode)
+        self.assertIsInstance(kCFStreamSocketSecurityLevelTLSv1, unicode)
+        self.assertIsInstance(kCFStreamSocketSecurityLevelNegotiatedSSL, unicode)
+        self.assertIsInstance(kCFStreamPropertyShouldCloseNativeSocket, unicode)
+        self.assertIsInstance(kCFStreamPropertySocketRemoteHost, unicode)
+        self.assertIsInstance(kCFStreamPropertySocketRemoteNetService, unicode)
+        self.assertEqual(kCFStreamSocketSecurityNone, 0)
+        self.assertEqual(kCFStreamSocketSecuritySSLv2, 1)
+        self.assertEqual(kCFStreamSocketSecuritySSLv3, 2)
+        self.assertEqual(kCFStreamSocketSecuritySSLv23, 3)