Fix some more ctypes tests.
This commit is contained in:
parent
992d4a3e6e
commit
13eb6cad7e
|
@ -34,17 +34,17 @@ class Test(unittest.TestCase):
|
|||
array = (c_char_p * 5)()
|
||||
self.failUnlessEqual(array._objects, None)
|
||||
array[0] = "foo bar"
|
||||
self.failUnlessEqual(array._objects, {'0': "foo bar"})
|
||||
self.failUnlessEqual(array._objects, {'0': b"foo bar"})
|
||||
|
||||
p = cast(array, POINTER(c_char_p))
|
||||
# array and p share a common _objects attribute
|
||||
self.failUnless(p._objects is array._objects)
|
||||
self.failUnlessEqual(array._objects, {'0': "foo bar", id(array): array})
|
||||
self.failUnlessEqual(array._objects, {'0': b"foo bar", id(array): array})
|
||||
p[0] = "spam spam"
|
||||
self.failUnlessEqual(p._objects, {'0': "spam spam", id(array): array})
|
||||
self.failUnlessEqual(p._objects, {'0': b"spam spam", id(array): array})
|
||||
self.failUnless(array._objects is p._objects)
|
||||
p[1] = "foo bar"
|
||||
self.failUnlessEqual(p._objects, {'1': 'foo bar', '0': "spam spam", id(array): array})
|
||||
self.failUnlessEqual(p._objects, {'1': b'foo bar', '0': b"spam spam", id(array): array})
|
||||
self.failUnless(array._objects is p._objects)
|
||||
|
||||
def test_other(self):
|
||||
|
|
|
@ -76,11 +76,11 @@ class ObjectsTestCase(unittest.TestCase):
|
|||
x = X()
|
||||
x.a = s1
|
||||
x.b = s2
|
||||
self.failUnlessEqual(x._objects, {"0": s1, "1": s2})
|
||||
self.failUnlessEqual(x._objects, {"0": bytes(s1), "1": bytes(s2)})
|
||||
|
||||
y = Y()
|
||||
y.x = x
|
||||
self.failUnlessEqual(y._objects, {"0": {"0": s1, "1": s2}})
|
||||
self.failUnlessEqual(y._objects, {"0": {"0": bytes(s1), "1": bytes(s2)}})
|
||||
## x = y.x
|
||||
## del y
|
||||
## print x._b_base_._objects
|
||||
|
|
Loading…
Reference in New Issue