[PyObjC-svn] r2479 - in trunk/pyobjc/pyobjc-core: Lib/objc PyObjCTest
[email protected] Fri, 14 May 2010 01:21:50 -0500
| Newsgroups | gmane.comp.python.pyobjc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: ronaldoussoren
Date: Fri May 14 01:21:50 2010
New Revision: 2479
Log:
Fix some more py3k issues. The py3k port now
has the same set of failures as the py2k original
(most of which are "please implement this test and feature")
Modified:
trunk/pyobjc/pyobjc-core/Lib/objc/_convenience.py
trunk/pyobjc/pyobjc-core/Lib/objc/_pycoder.py
trunk/pyobjc/pyobjc-core/PyObjCTest/test3_typecheck.py
trunk/pyobjc/pyobjc-core/PyObjCTest/test_archive_python.py
trunk/pyobjc/pyobjc-core/PyObjCTest/test_set_interface.py
Modified: trunk/pyobjc/pyobjc-core/Lib/objc/_convenience.py
==============================================================================
--- trunk/pyobjc/pyobjc-core/Lib/objc/_convenience.py (original)
+++ trunk/pyobjc/pyobjc-core/Lib/objc/_convenience.py Fri May 14 01:21:50 2010
@@ -346,7 +346,8 @@
_index_sentinel=object()
def index_indexOfObject_inRange_(self, item, start=0, stop=_index_sentinel):
- from Foundation import NSNotFound
+ #from Foundation import NSNotFound
+ NSNotFound = sys.maxsize
if start == 0 and stop is _index_sentinel:
res = self.indexOfObject_(container_wrap(item))
if res == NSNotFound:
Modified: trunk/pyobjc/pyobjc-core/Lib/objc/_pycoder.py
==============================================================================
--- trunk/pyobjc/pyobjc-core/Lib/objc/_pycoder.py (original)
+++ trunk/pyobjc/pyobjc-core/Lib/objc/_pycoder.py Fri May 14 01:21:50 2010
@@ -18,6 +18,9 @@
from pickle import PicklingError, UnpicklingError, whichmodule
+if hasattr(sys, 'intern'):
+ intern = sys.intern
+
# FIXME: This requires manual wrappers from the Foundation bindings
def setupPythonObject():
@@ -444,7 +447,13 @@
if state:
try:
- value.__dict__.update(state)
+ inst_dict = value.__dict__
+ for k, v in state.iteritems():
+ if type(k) == str:
+ inst_dict[intern(k)] = v
+ else:
+ inst_dict[k] = v
+
except RuntimeError:
for k, v in state.items():
setattr(value, intern(k), v)
@@ -493,7 +502,13 @@
if state:
try:
- value.__dict__.update(state)
+ inst_dict = value.__dict__
+
+ for k, v in state.iteritems():
+ if type(k) == str:
+ inst_dict[intern(k)] = v
+ else:
+ inst_dict[k] = v
except RuntimeError:
for k, v in state.items():
Modified: trunk/pyobjc/pyobjc-core/PyObjCTest/test3_typecheck.py
==============================================================================
--- trunk/pyobjc/pyobjc-core/PyObjCTest/test3_typecheck.py (original)
+++ trunk/pyobjc/pyobjc-core/PyObjCTest/test3_typecheck.py Fri May 14 01:21:50 2010
@@ -39,7 +39,7 @@
self.assertRaises(TypeError, objc.loadBundleFunctions, bundle, d, tab)
tab = [
- ( 'NSHomeDirectory', b'@'),
+ ( b'NSHomeDirectory', b'@'),
]
self.assertRaises(TypeError, objc.loadBundleFunctions, bundle, d, tab)
Modified: trunk/pyobjc/pyobjc-core/PyObjCTest/test_archive_python.py
==============================================================================
--- trunk/pyobjc/pyobjc-core/PyObjCTest/test_archive_python.py (original)
+++ trunk/pyobjc/pyobjc-core/PyObjCTest/test_archive_python.py Fri May 14 01:21:50 2010
@@ -338,6 +338,12 @@
@onlyIf(0, "python unittest not relevant for archiving")
def test_pickle_to_2x(self): pass
+ @onlyIf(0, "python unittest not relevant for archiving")
+ def test_bad_getattr(self): pass
+
+ @onlyIf(0, "python unittest not relevant for archiving")
+ def test_unicode(self): pass
+
def test_long(self):
# The real test_long method takes way to much time, test a subset
Modified: trunk/pyobjc/pyobjc-core/PyObjCTest/test_set_interface.py
==============================================================================
--- trunk/pyobjc/pyobjc-core/PyObjCTest/test_set_interface.py (original)
+++ trunk/pyobjc/pyobjc-core/PyObjCTest/test_set_interface.py Fri May 14 01:21:50 2010
@@ -21,6 +21,7 @@
thetype = NSSet
basetype = NSSet
+ def test_cyclical_print(self): pass
def test_cyclical_repr(self): pass
def test_pickling(self): pass
def test_do_not_rehash_dict_keys(self): pass
@@ -117,7 +118,11 @@
basetype = NSMutableSet
def test_copy(self):
- test.test_set.TestSet.test_copy(self)
+ dup = self.s.copy()
+ self.assertEqual(self.s, dup)
+ self.assertNotEqual(id(self.s), id(dup))
+ #self.assertEqual(type(dup), self.basetype)
+ self.assertIsInstance(dup, self.basetype)
# Tests from 'TestSet'
def test_init(self): pass
@@ -265,7 +270,7 @@
t = s.mutableCopy()
getattr(s, methname)(list(g(data)))
getattr(t, methname)(g(data))
- self.assertEqual(sorted(s), sorted(t))
+ self.assertEqual(sorted(s, key=repr), sorted(t, key=repr))
self.assertRaises(TypeError, getattr(set('january'), methname), test.test_set.X(data))
self.assertRaises(TypeError, getattr(set('january'), methname), test.test_set.N(data))
@@ -273,6 +278,8 @@
+
+
class TestGraphs (test.test_set.TestGraphs):
def setUp(self):
------------------------------------------------------------------------------