[PyObjC-svn] r2543 - in trunk/pyobjc/pyobjc-framework-Cocoa: . PyObjCTest
[email protected] Sun, 18 Jul 2010 08:00:24 -0500
| Newsgroups | gmane.comp.python.pyobjc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: ronaldoussoren
Date: Sun Jul 18 08:00:23 2010
New Revision: 2543
Log:
Minor test tweaks
Modified:
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_cfbundle.py
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_cfrunloop.py
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_cfusernotification.py
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nscoder.py
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsdata.py
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsview.py
trunk/pyobjc/pyobjc-framework-Cocoa/pyobjc_setup.py
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_cfbundle.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_cfbundle.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_cfbundle.py Sun Jul 18 08:00:23 2010
@@ -48,7 +48,7 @@
v = CFBundleGetLocalInfoDictionary(bundle)
if v is not None:
- self.failUnlessIsInstance(v, CFDictionaryRef)
+ self.assertIsInstance(v, CFDictionaryRef)
type, creator = CFBundleGetPackageInfo(bundle, None, None)
self.assertIsInstance(type, (int, long))
self.assertIsInstance(creator, (int, long))
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_cfrunloop.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_cfrunloop.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_cfrunloop.py Sun Jul 18 08:00:23 2010
@@ -84,9 +84,9 @@
observer = CFRunLoopObserverCreate(None, kCFRunLoopEntry|kCFRunLoopExit,
True, 4, callback, data)
self.assertIsInstance(observer, CFRunLoopObserverRef)
- self.failUnless (CFRunLoopContainsObserver(rl, observer, kCFRunLoopDefaultMode) is False)
+ self.assertIs(CFRunLoopContainsObserver(rl, observer, kCFRunLoopDefaultMode), False)
CFRunLoopAddObserver(rl, observer, kCFRunLoopDefaultMode)
- self.failUnless (CFRunLoopContainsObserver(rl, observer, kCFRunLoopDefaultMode) is True)
+ self.assertIs(CFRunLoopContainsObserver(rl, observer, kCFRunLoopDefaultMode), True)
# Use dummy stream to ensure that the runloop actually performs work
strval = b'hello world'
@@ -103,7 +103,7 @@
self.assertIsIn(item[1], (kCFRunLoopEntry, kCFRunLoopExit))
self.assertIs(item[2], data)
CFRunLoopRemoveObserver(rl, observer, kCFRunLoopDefaultMode)
- self.failUnless (CFRunLoopContainsObserver(rl, observer, kCFRunLoopDefaultMode) is False)
+ self.assertIs(CFRunLoopContainsObserver(rl, observer, kCFRunLoopDefaultMode), False)
def testTimer(self):
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_cfusernotification.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_cfusernotification.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_cfusernotification.py Sun Jul 18 08:00:23 2010
@@ -46,7 +46,7 @@
self.assertIsInstance(flags, (int, long))
v = CFUserNotificationGetResponseDictionary(ref)
if v is not None:
- self.failUnlessIsInstance(v, CFDictionaryRef)
+ self.assertIsInstance(v, CFDictionaryRef)
error = CFUserNotificationUpdate(ref, 2.0, 0, infoDict)
self.assertEqual(error , 0)
error = CFUserNotificationCancel(ref)
@@ -54,7 +54,7 @@
v = CFUserNotificationGetResponseValue(ref, kCFUserNotificationTextFieldValuesKey, 0)
if v is not None:
- self.failUnlessIsInstance(v, unicode)
+ self.assertIsInstance(v, unicode)
def testAlert(self):
err, flags = CFUserNotificationDisplayAlert(0.1, 0, None, None, None, "Header", "Message", "Cancel", None, None, None)
self.assertEqual(err , 0)
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nscoder.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nscoder.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nscoder.py Sun Jul 18 08:00:23 2010
@@ -4,6 +4,11 @@
from Foundation import *
from PyObjCTest.testhelper import PyObjC_TestClass4
+try:
+ memoryview
+except NameError:
+ memoryview = None
+
class TestNSCoderUsage(TestCase):
def testUsage(self):
class CoderClass1 (NSObject):
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsdata.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsdata.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsdata.py Sun Jul 18 08:00:23 2010
@@ -13,6 +13,11 @@
if sys.version_info[0] == 3:
buffer = memoryview
+try:
+ memoryview
+except NameError:
+ memoryview = None
+
class TestNSData(TestCase):
def testMethods(self):
self.assertResultIsBOOL(NSData.writeToFile_atomically_)
@@ -150,20 +155,20 @@
b, err = NSData.alloc().initWithContentsOfFile_options_error_(
"/etc/hosts", 0, None)
self.assertIsInstance(b, NSData)
- self.assertIsObject(err, None)
+ self.assertIs(err, None)
b2, err = NSData.alloc().initWithContentsOfFile_options_error_(
"/etc/hosts.nosuchfile", 0, None)
- self.assertIsObject(b2, None)
+ self.assertIs(b2, None)
self.assertIsInstance(err, NSError)
url = NSURL.fileURLWithPath_isDirectory_('/etc/hosts', False)
b, err = NSData.alloc().initWithContentsOfURL_options_error_(
url, 0, None)
self.assertIsInstance(b, NSData)
- self.assertIsObject(err, None)
+ self.assertIs(err, None)
url = NSURL.fileURLWithPath_isDirectory_('/etc/hosts.nosuchfile', False)
b2, err = NSData.alloc().initWithContentsOfURL_options_error_(
url, 0, None)
- self.assertIsObject(b2, None)
+ self.assertIs(b2, None)
self.assertIsInstance(err, NSError)
class MyData (NSData):
def dataWithBytes_length_(self, bytes, length):
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsview.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsview.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsview.py Sun Jul 18 08:00:23 2010
@@ -23,7 +23,7 @@
method = ObjCTestNSView_KnowPageRange.rectForPage_
- self.failUnlessResultHasType(method, NSRect.__typestr__)
+ self.assertResultHasType(method, NSRect.__typestr__)
#self.assertEqual(objc.splitSignature(method.signature), objc.splitSignature(NSRect.__typestr__+b"@:" + objc._C_NSInteger))
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/pyobjc_setup.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/pyobjc_setup.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/pyobjc_setup.py Sun Jul 18 08:00:23 2010
@@ -62,6 +62,8 @@
sys.path.remove(dirname)
# Actually run the tests
+ if sys.version_info[0] == 2:
+ sys.path.insert(0, rootdir)
import PyObjCTest
import unittest
from pkg_resources import EntryPoint
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first