[PyObjC-svn] r2127 - in trunk/pyobjc/pyobjc-framework-Cocoa: Doc Lib/AppKit Lib/Foundation Modules PyObjCTest
[email protected] Tue, 31 Mar 2009 18:49:17 -0500
Newsgroups
gmane.comp.python.pyobjc.cvs
Message-ID
<[email protected] >
Author: ronaldoussoren
Date: Tue Mar 31 18:49:17 2009
New Revision: 2127
Log:
Minor updates to improve test coverage and results
Added:
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsscriptcommanddescription.py (contents, props changed)
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsurl.py (contents, props changed)
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsurlrequest.py (contents, props changed)
Modified:
trunk/pyobjc/pyobjc-framework-Cocoa/Doc/api-notes-Foudation.txt
trunk/pyobjc/pyobjc-framework-Cocoa/Doc/api-notes-Foundation.txt
trunk/pyobjc/pyobjc-framework-Cocoa/Lib/AppKit/PyObjC.bridgesupport
trunk/pyobjc/pyobjc-framework-Cocoa/Lib/Foundation/PyObjC.bridgesupport
trunk/pyobjc/pyobjc-framework-Cocoa/Modules/_Foundation_NSDecimal.m
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsarray.py
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsbitmap.py
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsdecimal.py
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsdecimalnumber.py
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsdictionary.py
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsexception.py
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsfilemanager.py
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nshashtable.py
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nslayoutmanager.py
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsmaptable.py
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsnotificationqueue.py
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsnumber.py
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsobject.py
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsopenpanel.py
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nstimer.py
trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nstoolbaritem.py
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/Doc/api-notes-Foudation.txt
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/Doc/api-notes-Foudation.txt (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/Doc/api-notes-Foudation.txt Tue Mar 31 18:49:17 2009
@@ -132,3 +132,7 @@
This method is not supported
+``NSGetUncaughtExceptionHandler``
+---------------------------------
+
+This function is not yet supported.
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/Doc/api-notes-Foundation.txt
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/Doc/api-notes-Foundation.txt (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/Doc/api-notes-Foundation.txt Tue Mar 31 18:49:17 2009
@@ -26,6 +26,7 @@
* ``-decodeValuesOfObjCTypes:``: Use the basic decodeing methods instead
+
NSData, NSMutableData
---------------------
@@ -44,6 +45,13 @@
Use ``buffer(value)`` instead, those will automaticly be bridged to an instance of a
``NSData`` subclass.
+``NSDictionary``
+----------------
+
+* ``-getObjects:andKeys:``
+
+ This method is not supported.
+
NSDebug
-------
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/Lib/AppKit/PyObjC.bridgesupport
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/Lib/AppKit/PyObjC.bridgesupport (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/Lib/AppKit/PyObjC.bridgesupport Tue Mar 31 18:49:17 2009
@@ -15084,7 +15084,7 @@
<arg index='2' type='@' />
<arg index='3' type='@' />
<arg index='4' type='@' />
- <arg index='5' sel_of_type='v@:@i^v' type=':' />
+ <arg index='5' sel_of_type='v@:@i^v' />
<arg index='6' type='^v' />
</method>
<method selector='canChooseDirectories'>
@@ -17518,6 +17518,25 @@
<method selector='allowsOtherFileTypes'>
<retval type='B' />
</method>
+ <method selector='beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo:'>
+ <retval type='v' />
+ <arg index='0' type='@' />
+ <arg index='1' type='@' />
+ <arg index='2' type='@' />
+ <arg index='3' type='@' />
+ <arg index='4' type='@' />
+ <arg index='5' sel_of_type='v@:@i^v' />
+ <arg index='6' type='^v' />
+ </method>
+ <method selector='beginForDirectory:file:types:modelessDelegate:didEndSelector:contextInfo:'>
+ <retval type='v' />
+ <arg index='0' type='@' />
+ <arg index='1' type='@' />
+ <arg index='2' type='@' />
+ <arg index='3' type='@' />
+ <arg index='4' sel_of_type='v@:@i^v' type=':' />
+ <arg index='5' type='^v' />
+ </method>
<method selector='beginSheetForDirectory:file:modalForWindow:modalDelegate:didEndSelector:contextInfo:'>
<retval type='v' />
<arg index='0' type='@' />
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/Lib/Foundation/PyObjC.bridgesupport
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/Lib/Foundation/PyObjC.bridgesupport (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/Lib/Foundation/PyObjC.bridgesupport Tue Mar 31 18:49:17 2009
@@ -561,23 +561,6 @@
<enum name='NSNumberFormatterSpellOutStyle' value='5' />
<enum name='NSNumericSearch' value='64' />
<enum name='NSOSF1OperatingSystem' value='7' />
- <enum name='NSObjCArrayType' value='91' />
- <enum name='NSObjCBitfield' value='98' />
- <enum name='NSObjCBoolType' value='66' />
- <enum name='NSObjCCharType' value='99' />
- <enum name='NSObjCDoubleType' value='100' />
- <enum name='NSObjCFloatType' value='102' />
- <enum name='NSObjCLongType' value='108' />
- <enum name='NSObjCLonglongType' value='113' />
- <enum name='NSObjCNoType' value='0' />
- <enum name='NSObjCObjectType' value='64' />
- <enum name='NSObjCPointerType' value='94' />
- <enum name='NSObjCSelectorType' value='58' />
- <enum name='NSObjCShortType' value='115' />
- <enum name='NSObjCStringType' value='42' />
- <enum name='NSObjCStructType' value='123' />
- <enum name='NSObjCUnionType' value='40' />
- <enum name='NSObjCVoidType' value='118' />
<enum name='NSDecimalNoScale' value='32767' />
<enum name='NSObjectAutoreleasedEvent' value='3' />
<enum name='NSObjectExtraRefDecrementedEvent' value='5' />
@@ -913,6 +896,77 @@
<enum name='NS_LittleEndian' value='1' />
<enum name='NS_UNICHAR_IS_EIGHT_BIT' value='0' />
<enum name='NS_UnknownByteOrder' value='0' />
+ <function name='NSDecimalAdd' >
+ <retval type='I' type64='Q' />
+ <arg type='^{_NSDecimal=}' />
+ <arg type='^{_NSDecimal=}' />
+ <arg type='^{_NSDecimal=}' />
+ <arg type='I' type64='Q' />
+ </function>
+ <function name='NSDecimalDivide' >
+ <retval type='I' type64='Q' />
+ <arg type='^{_NSDecimal=}' />
+ <arg type='^{_NSDecimal=}' />
+ <arg type='^{_NSDecimal=}' />
+ <arg type='I' type64='Q' />
+ </function>
+ <function name='NSDecimalMultiply' >
+ <retval type='I' type64='Q' />
+ <arg type='^{_NSDecimal=}' />
+ <arg type='^{_NSDecimal=}' />
+ <arg type='^{_NSDecimal=}' />
+ <arg type='I' type64='Q' />
+ </function>
+ <function name='NSDecimalSubtract' >
+ <retval type='I' type64='Q' />
+ <arg type='^{_NSDecimal=}' />
+ <arg type='^{_NSDecimal=}' />
+ <arg type='^{_NSDecimal=}' />
+ <arg type='I' type64='Q' />
+ </function>
+ <function name='NSDecimalCopy' >
+ <retval type='v' type64='v' />
+ <arg type='^{_NSDecimal=}' />
+ <arg type='^{_NSDecimal=}' />
+ </function>
+ <function name='NSDecimalCompare' >
+ <retval type='i' />
+ <arg type='^{_NSDecimal=}' />
+ <arg type='^{_NSDecimal=}' />
+ </function>
+ <function name='NSDecimalRound' >
+ <retval type='v' />
+ <arg type='^{_NSDecimal=}' />
+ <arg type='^{_NSDecimal=}' />
+ <arg type='I' type64='Q' />
+ <arg type='I' type64='Q' />
+ </function>
+ <function name='NSDecimalNormalize' >
+ <retval type='I' type64='Q' />
+ <arg type='^{_NSDecimal=}' />
+ <arg type='^{_NSDecimal=}' />
+ <arg type='I' type64='Q' />
+ </function>
+ <function name='NSDecimalPower' >
+ <retval type='I' type64='Q' />
+ <arg type='^{_NSDecimal=}' />
+ <arg type='^{_NSDecimal=}' />
+ <arg type='I' type64='Q' />
+ <arg type='I' type64='Q' />
+ </function>
+ <function name='NSDecimalString' >
+ <retval type='@' />
+ <arg type='^{_NSDecimal=}' />
+ <arg type='@' />
+ </function>
+ <function name='NSDecimalCompact' >
+ <retval type='v' type64='v' />
+ <arg type='^{_NSDecimal=}' />
+ </function>
+ <function name='NSDecimalIsNotANumber' >
+ <retval type='B' type64='B' />
+ <arg type='^{_NSDecimal=}' />
+ </function>
<function name='NSAllHashTableObjects'>
<retval type='@' type64='@' />
<arg type='@' type64='@' />
@@ -2219,6 +2273,24 @@
</method>
</class>
<class name='NSArray'>
+ <method selector='sortedArrayUsingFunction:context:' >
+ <arg index='0' function_pointer='true' function_pointer_retained='false'>
+ <retval type='i'/>
+ <arg type='@' />
+ <arg type='@' />
+ <arg type='@' />
+ </arg>
+ <arg index='1' type='@' />
+ </method>
+ <method selector='sortedArrayUsingFunction:context:hint:' >
+ <arg index='0' function_pointer='true' function_pointer_retained='false'>
+ <retval type='i'/>
+ <arg type='@' />
+ <arg type='@' />
+ <arg type='@' />
+ </arg>
+ <arg index='1' type='@' />
+ </method>
<method selector='addObserver:forKeyPath:options:context:'>
<retval type='v' />
<arg index='0' type='@' />
@@ -4306,9 +4378,6 @@
<arg index='0' type='@' />
<arg index='1' type='@' />
</method>
- <method selector='decimalValue'>
- <retval type='{NSDecimal=b8b4b1b1b18[8S]}' />
- </method>
<method class_method='true' selector='defaultBehavior'>
<retval type='@' />
</method>
@@ -4453,7 +4522,7 @@
<arg c_array_length_in_arg='2' index='1' type_modifier='n' />
<arg index='2' type='I' type64='Q' />
</method>
- <method class_method='true' selector='dictionaryWithObjectsAndKeys:' variadic='true'>
+ <method class_method='true' selector='dictionaryWithObjectsAndKeys:' variadic='true' c_array_delimited_by_null='true'>
<retval type='@' />
<arg index='0' type='@' />
</method>
@@ -4530,8 +4599,8 @@
</method>
<method selector='initWithObjects:forKeys:count:'>
<retval type='@' />
- <arg c_array_length_in_arg='2' index='0' />
- <arg c_array_length_in_arg='2' index='1' />
+ <arg c_array_length_in_arg='2' index='0' type_modifier='n' />
+ <arg c_array_length_in_arg='2' index='1' type_modifier='n' />
<arg index='2' type='I' type64='Q' />
</method>
<method c_array_delimited_by_null='true' selector='initWithObjectsAndKeys:' variadic='true'>
@@ -5184,7 +5253,7 @@
</method>
<method selector='stringWithFileSystemRepresentation:length:'>
<retval type='@' />
- <arg c_array_length_in_arg='1' index='0' type='^t' />
+ <arg c_array_length_in_arg='1' index='0' type='^t' type_modifier='n' />
<arg index='1' type='I' type64='Q' />
</method>
<method selector='subpathsAtPath:'>
@@ -6298,6 +6367,16 @@
</method>
</class>
<class name='NSMutableArray'>
+ <method selector='sortUsingFunction:context:' >
+ <arg index='0' function_pointer='true' function_pointer_retained='false' >
+ <retval type='i' />
+ <arg type='@' />
+ <arg type='@' />
+ <arg type='@' />
+ </arg>
+ <arg index='1' type='@' />
+ </method>
+
<method selector='addObject:'>
<retval type='v' />
<arg index='0' type='@' />
@@ -7699,6 +7778,14 @@
</method>
</class>
<class name='NSObject'>
+ <method selector='mutableCopyWithZone:'>
+ <retval type='@' />
+ <arg index='0' type='^{_NSZone=}' />
+ </method>
+ <method class_method='true' selector='mutableCopyWithZone:'>
+ <retval type='@' />
+ <arg index='0' type='^{_NSZone=}' />
+ </method>
<method selector=''>
<retval type='v' />
</method>
@@ -7988,6 +8075,7 @@
</method>
<method class_method='true' selector='copyWithZone:'>
<retval type='@' />
+ <arg index='0' type='^{_NSZone=}' />
</method>
<method selector='countByEnumeratingWithState:objects:count:' suggestion='use python iteration' />
<method selector='createConversationForConnection:'>
@@ -8317,9 +8405,11 @@
</method>
<method selector='mutableCopyWithZone:'>
<retval type='@' />
+ <arg index='0' type='^{_NSZone=}' />
</method>
<method class_method='true' selector='mutableCopyWithZone:'>
<retval type='@' />
+ <arg index='0' type='^{_NSZone=}' />
</method>
<method selector='mutableSetValueForKey:'>
<retval type='@' />
@@ -9876,7 +9966,7 @@
</method>
<method selector='scanDecimal:'>
<retval type='B' />
- <arg index='0' null_accepted='false' type_modifier='o' />
+ <arg index='0' null_accepted='false' />
</method>
<method selector='scanDouble:'>
<retval type='B' />
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/Modules/_Foundation_NSDecimal.m
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/Modules/_Foundation_NSDecimal.m (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/Modules/_Foundation_NSDecimal.m Tue Mar 31 18:49:17 2009
@@ -1132,6 +1132,7 @@
Class classNSDecimalNumber = objc_lookUpClass("NSDecimalNumber");
+ Class classNSNumber = objc_lookUpClass("NSNumber");
if (PyObjC_RegisterMethodMapping(
classNSDecimalNumber,
@@ -1162,7 +1163,7 @@
}
if (PyObjC_RegisterMethodMapping(
- classNSDecimalNumber,
+ classNSNumber,
@selector(decimalValue),
call_NSDecimalNumber_decimalValue,
imp_NSDecimalNumber_decimalValue) < 0) {
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsarray.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsarray.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsarray.py Tue Mar 31 18:49:17 2009
@@ -273,9 +273,14 @@
a = NSMutableArray.arrayWithArray_(range(4))
self.assertEquals(a, (0, 1, 2, 3))
- self.assertRaises(TypeError, a.sortUsingFunction_context_, dir)
- self.assertRaises(TypeError, a.sortUsingFunction_context_, dir, 1, 2)
- self.assertRaises(TypeError, a.sortUsingFunction_context_, cmp, u'a')
+ t = objc.getVerbose()
+ objc.setVerbose(0)
+ try:
+ self.assertRaises(TypeError, a.sortUsingFunction_context_, dir)
+ self.assertRaises(TypeError, a.sortUsingFunction_context_, dir, 1, 2)
+ self.assertRaises(TypeError, a.sortUsingFunction_context_, cmp, u'a')
+ finally:
+ objc.setVerbose(t)
def testSort2(self):
a = NSMutableArray.arrayWithArray_(range(10))
@@ -430,16 +435,16 @@
self.failUnlessArgIsIn(NSMutableArray.removeObjectsFromIndices_numIndices_, 0)
self.failUnlessArgSizeInArg(NSMutableArray.removeObjectsFromIndices_numIndices_, 0, 1)
- self.failUnlessArgIsFunction(NSArray.sortedArrayUsingFunction_context_, 0, 'I@@@', False)
+ self.failUnlessArgIsFunction(NSArray.sortedArrayUsingFunction_context_, 0, 'i@@@', False)
self.failUnlessArgHasType(NSArray.sortedArrayUsingFunction_context_, 1, '@')
- self.failUnlessArgIsFunction(NSArray.sortedArrayUsingFunction_context_hint_, 0, 'I@@@', False)
+ self.failUnlessArgIsFunction(NSArray.sortedArrayUsingFunction_context_hint_, 0, 'i@@@', False)
self.failUnlessArgHasType(NSArray.sortedArrayUsingFunction_context_hint_, 1, '@')
- self.failUnlessArgIsFunction(NSMutableArray.sortUsingFunction_context_, 0, 'I@@@', False)
+ self.failUnlessArgIsFunction(NSMutableArray.sortUsingFunction_context_, 0, 'i@@@', False)
self.failUnlessArgHasType(NSMutableArray.sortUsingFunction_context_, 1, '@')
- self.fail("-arrayWithObjects:")
- self.fail("-initWithObjects:")
+ self.failUnlessIsNullTerminated(NSArray.arrayWithObjects_)
+ self.failUnlessIsNullTerminated(NSArray.initWithObjects_)
if __name__ == '__main__':
main()
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsbitmap.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsbitmap.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsbitmap.py Tue Mar 31 18:49:17 2009
@@ -4,7 +4,7 @@
class TestNSBitmapImageRep (TestCase):
def test_getTIFFCompressionTypes(self):
- r = AppKit.NSBitmapImageRep.getTIFFCompressionTypes_count_()
+ r = AppKit.NSBitmapImageRep.getTIFFCompressionTypes_count_(None, None)
self.assert_(isinstance(r, tuple))
self.assertEquals(len(r), 2)
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsdecimal.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsdecimal.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsdecimal.py Tue Mar 31 18:49:17 2009
@@ -76,17 +76,29 @@
v = NSDecimalIsNotANumber(o)
self.failUnless(v is False)
- self.fail('NSDecimalCopy')
- self.fail('NSDecimalCompact')
- self.fail('NSDecimalCompare')
- self.fail('NSDecimalRound')
- self.fail('NSDecimalNormalize')
- self.fail('NSDecimalAdd')
- self.fail('NSDecimalSubtract')
- self.fail('NSDecimalMultiply')
- self.fail('NSDecimalDivide')
- self.fail('NSDecimalPower')
- self.fail('NSDecimalString')
+ v = NSDecimal()
+ NSDecimalCopy(v, o)
+ self.failUnlessEqual(str(v), str(o))
+
+ NSDecimalCompact(v)
+
+ i = NSDecimalCompare(o, p)
+ self.failUnlessIsInstance(i, (int, long))
+
+ NSDecimalRound(v, o, 0, NSRoundBankers)
+ self.failUnlessEqual(str(v), '2')
+
+ t = NSDecimalNormalize(v, o, NSRoundBankers)
+ self.failUnlessEqual(t, NSCalculationNoError)
+ self.failUnlessEqual(str(v), '2.0')
+
+ t = NSDecimalPower(v, o, 3, NSRoundBankers)
+ self.failUnlessEqual(t, NSCalculationNoError)
+ self.failUnlessEqual(str(v), '3.375')
+
+ t = NSDecimalString(v, None)
+ self.failUnlessEqual(t, u'3.375')
+
def testCompare(self):
small = NSDecimal(u"1")
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsdecimalnumber.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsdecimalnumber.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsdecimalnumber.py Tue Mar 31 18:49:17 2009
@@ -11,15 +11,32 @@
self.failUnless(isinstance(NSDecimalNumberDivideByZeroException, unicode))
def testNSDecimal(self):
- self.fail("initWithDecimal:")
- self.fail("decimalValue")
- self.fail("decimalNumberWithDecimal:")
+ dec = NSDecimal('55.0')
+
+ v = NSDecimalNumber.alloc().initWithDecimal_(dec)
+ self.failUnlessIsInstance(v, NSDecimalNumber)
+ self.failUnlessEqual(str(v), '55')
+
+ v = NSDecimalNumber.decimalNumberWithDecimal_(dec)
+ self.failUnlessIsInstance(v, NSDecimalNumber)
+ self.failUnlessEqual(str(v), '55')
+
+ o = v.decimalValue()
+ self.failUnlessIsInstance(o, NSDecimal)
def testNSNumberAsNSDecimal(self):
- self.fail('NSNumber.decimalValue')
+ v = NSNumber.numberWithFloat_(33.5)
+ o = v.decimalValue()
+ self.failUnlessIsInstance(o, NSDecimal)
def testNSScannerWithDecimal(self):
- self.fail('NSScanner.scanDecimal')
+ v = NSScanner.alloc().initWithString_("55.23")
+
+ dec = NSDecimal()
+ o = v.scanDecimal_(dec)
+ self.failUnless(o is True)
+
+ self.failUnlessEqual(str(dec), '55.23')
if __name__ == "__main__":
main()
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsdictionary.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsdictionary.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsdictionary.py Tue Mar 31 18:49:17 2009
@@ -251,8 +251,6 @@
self.assertEquals(o, {'a':42, 'b':43})
self.assert_(isinstance(o, NSMutableDictionary))
- def testGetObjectsAndKeys(self):
- self.fail("getObjects:andKeys:")
class TestNSDictionary (TestCase):
def testMethods(self):
@@ -276,8 +274,8 @@
self.failUnlessArgIsBOOL(NSDictionary.initWithDictionary_copyItems_, 1)
- self.fail("-initWithObjectsAndKeys:")
- self.fail("-dictionaryWithObjectsAndKeys:")
+ self.failUnlessIsNullTerminated(NSDictionary.initWithObjectsAndKeys_)
+ self.failUnlessIsNullTerminated(NSDictionary.dictionaryWithObjectsAndKeys_)
if __name__ == '__main__':
main( )
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsexception.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsexception.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsexception.py Tue Mar 31 18:49:17 2009
@@ -38,8 +38,8 @@
self.failUnless( isinstance(NSPortReceiveException, unicode) )
self.failUnless( isinstance(NSOldStyleException, unicode) )
+ @expectedFailure
def testUncaughtExceptionHandler(self):
- self.fail("NSGetUncaughtExceptionHandler")
self.fail("NSSetUncaughtExceptionHandler")
def testNoAssert(self):
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsfilemanager.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsfilemanager.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsfilemanager.py Tue Mar 31 18:49:17 2009
@@ -195,7 +195,7 @@
self.failUnlessResultIsBOOL(NSFileManager.createFileAtPath_contents_attributes_)
self.failUnlessResultHasType(NSFileManager.fileSystemRepresentationWithPath_, '^' + objc._C_CHAR_AS_TEXT)
self.failUnlessResultIsNullTerminated(NSFileManager.fileSystemRepresentationWithPath_)
- self.failUnlessArgHasType(NSFileManager.stringWithFileSystemRepresentation_length_, 0, '^' + objc._C_CHAR_AS_TEXT)
+ self.failUnlessArgHasType(NSFileManager.stringWithFileSystemRepresentation_length_, 0, 'n^' + objc._C_CHAR_AS_TEXT)
self.failUnlessArgSizeInArg(NSFileManager.stringWithFileSystemRepresentation_length_, 0, 1)
self.failUnlessResultIsBOOL(NSDictionary.fileIsImmutable)
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nshashtable.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nshashtable.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nshashtable.py Tue Mar 31 18:49:17 2009
@@ -10,6 +10,7 @@
self.assertEquals(NSHashTableCopyIn, NSPointerFunctionsCopyIn)
self.assertEquals(NSHashTableObjectPointerPersonality, NSPointerFunctionsObjectPointerPersonality)
+ @expectedFailure
def testFunctions(self):
self.fail("NSHasTable functions")
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nslayoutmanager.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nslayoutmanager.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nslayoutmanager.py Tue Mar 31 18:49:17 2009
@@ -99,6 +99,10 @@
self.failUnlessArgIsBOOL(NSLayoutManager.getLineFragmentInsertionPointsForCharacterAtIndex_alternatePositions_inDisplayOrder_positions_characterIndexes_, 2)
self.failUnlessArgIsOut(NSLayoutManager.getLineFragmentInsertionPointsForCharacterAtIndex_alternatePositions_inDisplayOrder_positions_characterIndexes_, 3)
self.failUnlessArgIsOut(NSLayoutManager.getLineFragmentInsertionPointsForCharacterAtIndex_alternatePositions_inDisplayOrder_positions_characterIndexes_, 4)
+
+ @min_os_level('10.5')
+ @expectedFailure
+ def testMethods10_5_fail(self):
self.fail("Buffer size is non-trivial: - (NSUInteger)getLineFragmentInsertionPointsForCharacterAtIndex:(NSUInteger)charIndex alternatePositions:(BOOL)aFlag inDisplayOrder:(BOOL)dFlag positions:(CGFloat *)positions characterIndexes:(NSUInteger *)charIndexes;")
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsmaptable.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsmaptable.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsmaptable.py Tue Mar 31 18:49:17 2009
@@ -10,6 +10,7 @@
self.assertEquals(NSMapTableCopyIn, NSPointerFunctionsCopyIn)
self.assertEquals(NSMapTableObjectPointerPersonality, NSPointerFunctionsObjectPointerPersonality)
+ @expectedFailure
def testFunctions(self):
self.fail("NSMapTable C-API is untested")
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsnotificationqueue.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsnotificationqueue.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsnotificationqueue.py Tue Mar 31 18:49:17 2009
@@ -5,7 +5,7 @@
class TestNSNotificationQueue (TestCase):
def testConstants(self):
- self.assertEquals(NSPostWhenIdle, -1)
+ self.assertEquals(NSPostWhenIdle, 1)
self.assertEquals(NSPostASAP, 2)
self.assertEquals(NSPostNow, 3)
@@ -15,4 +15,4 @@
if __name__ == "__main__":
- unitest.main()
+ main()
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsnumber.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsnumber.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsnumber.py Tue Mar 31 18:49:17 2009
@@ -31,9 +31,6 @@
class TestNSNumber( TestCase ):
- def testFixme(self):
- self.fail("need attention")
-
def testSimple(self):
self.assertEquals(NSNumber.numberWithFloat_(1.0), 1,0)
self.assertEquals(NSNumber.numberWithInt_(1), 1)
@@ -201,25 +198,30 @@
self.assertEquals(stripDocType(data), stripDocType(PLIST))
-if isinstance(NSDecimalNumber.decimalNumberWithString_(u'1.00'), NSDecimalNumber):
- class TestDecimalNumber (TestCase):
- # NSDecimalNumber is treated specially
-
- # TODO: Add tests for using decimal numbers (addition, multiplication, ...)
-
- def testProxy (self):
- o = NSDecimalNumber.decimalNumberWithString_(u"1.00")
- self.assert_(isinstance(o, NSDecimalNumber))
-
-else:
- class TestDecimalNumber (TestCase):
- # NSDecimalNumber is treated specially
+class TestDecimalNumber (TestCase):
+ def testProxy (self):
+ one = NSDecimalNumber.decimalNumberWithString_(u"1.00")
+ self.assert_(isinstance(one, NSDecimalNumber))
+
+ two = NSDecimalNumber.decimalNumberWithString_(u"2.00")
+ self.assert_(isinstance(two, NSDecimalNumber))
+
+ three = NSDecimalNumber.decimalNumberWithString_(u"3.00")
+ self.assert_(isinstance(three, NSDecimalNumber))
+
+ six = NSDecimalNumber.decimalNumberWithString_(u"6.00")
+ self.assert_(isinstance(six, NSDecimalNumber))
+
+ one_half = NSDecimalNumber.decimalNumberWithString_(u"0.50")
+ self.assert_(isinstance(one_half, NSDecimalNumber))
+
+
+ self.failUnlessEqual(one + two, three)
+ self.failUnlessEqual(three - one, two)
+ self.failUnlessEqual(three * two, six)
+ self.failUnlessEqual(one / two, one_half)
- # TODO: Add tests for using decimal numbers (addition, multiplication, ...)
- def testProxy (self):
- o = NSDecimalNumber.decimalNumberWithString_(u"1.00")
- self.assert_(isinstance(o, NSDecimal))
if __name__ == '__main__':
main( )
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsobject.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsobject.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsobject.py Tue Mar 31 18:49:17 2009
@@ -5,6 +5,8 @@
class TestNSObjectHelper (NSObject):
def copyWithZone_(self, zn): return None
def mutableCopyWithZone_(self, zn): return None
+ def isContentDiscarded(self): return 1
+ def beginContentAccess(self): return 1
class TestNSObjectFunctions (TestCase):
def testAllocation(self):
@@ -111,6 +113,10 @@
self.failUnlessArgHasType(a.copyWithZone_, 0, '^{_NSZone=}')
self.failUnlessArgHasType(a.mutableCopyWithZone_, 0, '^{_NSZone=}')
+ @min_os_level('10.6')
+ def testMethods10_6(self):
+ self.failUnlessResultIsBOOL(TestNSObjectHelper.beginContentAccess)
+ self.failUnlessResultIsBOOL(TestNSObjectHelper.isContentDiscarded)
if __name__ == '__main__':
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsopenpanel.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsopenpanel.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nsopenpanel.py Tue Mar 31 18:49:17 2009
@@ -26,11 +26,11 @@
self.failUnlessArgIsBOOL(NSOpenPanel.setCanChooseFiles_, 0)
panel = NSOpenPanel.openPanel()
- self.failUnlessArgIsSEL(NSOpenPanel.beginSheetForDirectory_file_types_modalForWindow_modalDelegate_didEndSelector_contextInfo_, 5, 'v@:@i^v')
- self.failUnlessArgHasType(NSOpenPanel.beginSheetForDirectory_file_types_modalForWindow_modalDelegate_didEndSelector_contextInfo_, 6, '^v')
+ self.failUnlessArgIsSEL(panel.beginSheetForDirectory_file_types_modalForWindow_modalDelegate_didEndSelector_contextInfo_, 5, 'v@:@i^v')
+ self.failUnlessArgHasType(panel.beginSheetForDirectory_file_types_modalForWindow_modalDelegate_didEndSelector_contextInfo_, 6, '^v')
- self.failUnlessArgIsSEL(NSOpenPanel.beginForDirectory_file_types_modelessDelegate_didEndSelector_contextInfo_, 4, 'v@:@i^v')
- self.failUnlessArgHasType(NSOpenPanel.beginForDirectory_file_types_modelessDelegate_didEndSelector_contextInfo_, 5, '^v')
+ self.failUnlessArgIsSEL(panel.beginForDirectory_file_types_modelessDelegate_didEndSelector_contextInfo_, 4, 'v@:@i^v')
+ self.failUnlessArgHasType(panel.beginForDirectory_file_types_modelessDelegate_didEndSelector_contextInfo_, 5, '^v')
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nstimer.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nstimer.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nstimer.py Tue Mar 31 18:49:17 2009
@@ -17,6 +17,7 @@
def _testHelp(self):
obj = PythonClass()
pool = NSAutoreleasePool.new()
+ self.failUnlessArgIsBOOL(NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_, 4)
timer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(
0.1, obj, 'fire:', None, False)
NSRunLoop.currentRunLoop().addTimer_forMode_(
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nstoolbaritem.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nstoolbaritem.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/PyObjCTest/test_nstoolbaritem.py Tue Mar 31 18:49:17 2009
@@ -25,7 +25,7 @@
self.failUnlessArgIsBOOL(NSToolbarItem.setEnabled_, 0)
self.failUnlessResultIsBOOL(NSToolbarItem.autovalidates)
self.failUnlessArgIsBOOL(NSToolbarItem.setAutovalidates_, 0)
- self.failUnlessResultIsBOOL(NSToolbarItem.allowsDuplicatesInToolbar_)
+ self.failUnlessResultIsBOOL(NSToolbarItem.allowsDuplicatesInToolbar)
def testProtocols(self):
self.failUnlessResultIsBOOL(TestNSToolbarItemHelper.validateToolbarItem_)
------------------------------------------------------------------------------