Ronald Oussoren avatar Ronald Oussoren committed 4db5fca

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")

Comments (0)

Files changed (5)

pyobjc-core/Lib/objc/_convenience.py

 
 _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:

pyobjc-core/Lib/objc/_pycoder.py

 
 from pickle import PicklingError, UnpicklingError, whichmodule
 
+if hasattr(sys, 'intern'):
+    intern = sys.intern
+
 
 # FIXME: This requires manual wrappers from the Foundation bindings
 def setupPythonObject():
 
         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)
 
         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():

pyobjc-core/PyObjCTest/test3_typecheck.py

         self.assertRaises(TypeError, objc.loadBundleFunctions, bundle, d, tab)
 
         tab = [
-                ( 'NSHomeDirectory', b'@'),
+                ( b'NSHomeDirectory', b'@'),
         ]
         self.assertRaises(TypeError, objc.loadBundleFunctions, bundle, d, tab)
 

pyobjc-core/PyObjCTest/test_archive_python.py

         @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

pyobjc-core/PyObjCTest/test_set_interface.py

     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
     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
                     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))
 
 
 
+
+
 class TestGraphs (test.test_set.TestGraphs):
     def setUp(self):
         test.test_set.set = NSMutableSet
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.