Commit 13eb6cad authored by Thomas Heller's avatar Thomas Heller

Fix some more ctypes tests.

parent 992d4a3e
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment