mirror of https://github.com/kivy/pyobjus.git
tests: fix some tests on nsstring / nsobject
This commit is contained in:
parent
68af584922
commit
4ba3f9c6f0
|
@ -644,7 +644,7 @@ def autoclass(cls_name, **kwargs):
|
|||
if copy_properties:
|
||||
properties_dict = get_class_proerties(cls)
|
||||
global tmp_properties_keys
|
||||
tmp_properties_keys = properties_dict.keys()
|
||||
tmp_properties_keys[:] = properties_dict.keys()
|
||||
|
||||
cdef dict instance_methods
|
||||
cdef dict class_methods
|
||||
|
|
|
@ -12,7 +12,8 @@ class NSObject(unittest.TestCase):
|
|||
NSString = autoclass('NSString')
|
||||
|
||||
def test_hash(self):
|
||||
self.assertIsInstance(NSObject.hash(), long)
|
||||
a = NSObject.alloc().init()
|
||||
self.assertIsInstance(a.hash, long)
|
||||
|
||||
def test_isequal(self):
|
||||
a = NSObject.alloc().init()
|
||||
|
@ -26,13 +27,13 @@ class NSObject(unittest.TestCase):
|
|||
|
||||
def test_description(self):
|
||||
a = NSObject.alloc().init()
|
||||
text = a.description()
|
||||
text = a.description
|
||||
self.assertIsNotNone(text)
|
||||
|
||||
def test_debugDescription(self):
|
||||
a = NSObject.alloc()
|
||||
text = a.debugDescription()
|
||||
text = a.description()
|
||||
text = a.debugDescription
|
||||
text = a.description
|
||||
self.assertIsNotNone(text)
|
||||
self.assertIsNotNone(text.cString())
|
||||
self.assertTrue(text.cString().startswith('<NSObject:'))
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import unittest
|
||||
from pyobjus import ObjcClass, ObjcMethod, MetaObjcClass, autoclass, objc_py_types as opy
|
||||
from pyobjus import autoclass, objc_py_types as opy
|
||||
|
||||
NSString = None
|
||||
NSString = autoclass('NSString')
|
||||
N = lambda x: NSString.alloc().initWithUTF8String_(x)
|
||||
|
||||
class NSObject(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
global NSString
|
||||
NSString = autoclass('NSString')
|
||||
|
||||
def test_utf8(self):
|
||||
s = u'\x09cole'
|
||||
text = N(s)
|
||||
|
@ -82,10 +78,6 @@ class NSObject(unittest.TestCase):
|
|||
text = N('./gsoc/pyobjus')
|
||||
self.assertFalse(text.isAbsolutePath())
|
||||
|
||||
def test_smallestEncoding(self):
|
||||
text = N("some text")
|
||||
self.assertEquals(text.smallestEncoding(), opy.NSStringEncoding.NSMacOSRomanStringEncoding)
|
||||
|
||||
def test_fastestEncoding(self):
|
||||
text = N("šome text")
|
||||
self.assertEquals(text.fastestEncoding(), opy.NSStringEncoding.NSUnicodeStringEncoding)
|
||||
|
|
Loading…
Reference in New Issue