Kaydet (Commit) 78643128 authored tarafından Collin Winter's avatar Collin Winter

Avoid hardcoding refcounts in tests.

üst 2060e422
...@@ -23,16 +23,16 @@ class ObjectsTestCase(unittest.TestCase): ...@@ -23,16 +23,16 @@ class ObjectsTestCase(unittest.TestCase):
def test_ints(self): def test_ints(self):
i = 42000123 i = 42000123
self.assertEqual(3, grc(i)) refcnt = grc(i)
ci = c_int(i) ci = c_int(i)
self.assertEqual(3, grc(i)) self.assertEqual(refcnt, grc(i))
self.assertEqual(ci._objects, None) self.assertEqual(ci._objects, None)
def test_c_char_p(self): def test_c_char_p(self):
s = "Hello, World" s = "Hello, World"
self.assertEqual(3, grc(s)) refcnt = grc(s)
cs = c_char_p(s) cs = c_char_p(s)
self.assertEqual(4, grc(s)) self.assertEqual(refcnt + 1, grc(s))
self.assertSame(cs._objects, s) self.assertSame(cs._objects, s)
def test_simple_struct(self): def test_simple_struct(self):
......
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