~ubuntu-branches/ubuntu/lucid/python2.6/lucid

« back to all changes in this revision

Viewing changes to Lib/ctypes/test/test_structures.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-10-03 12:03:05 UTC
  • mto: (10.1.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 32.
  • Revision ID: james.westby@ubuntu.com-20091003120305-hij6yssh0figh590
Tags: upstream-2.6.3
ImportĀ upstreamĀ versionĀ 2.6.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
355
355
        self.failUnless("from_address" in dir(type(Structure)))
356
356
        self.failUnless("in_dll" in dir(type(Structure)))
357
357
 
 
358
    def test_positional_args(self):
 
359
        # see also http://bugs.python.org/issue5042
 
360
        class W(Structure):
 
361
            _fields_ = [("a", c_int), ("b", c_int)]
 
362
        class X(W):
 
363
            _fields_ = [("c", c_int)]
 
364
        class Y(X):
 
365
            pass
 
366
        class Z(Y):
 
367
            _fields_ = [("d", c_int), ("e", c_int), ("f", c_int)]
 
368
 
 
369
        z = Z(1, 2, 3, 4, 5, 6)
 
370
        self.failUnlessEqual((z.a, z.b, z.c, z.d, z.e, z.f),
 
371
                             (1, 2, 3, 4, 5, 6))
 
372
        z = Z(1)
 
373
        self.failUnlessEqual((z.a, z.b, z.c, z.d, z.e, z.f),
 
374
                             (1, 0, 0, 0, 0, 0))
 
375
        self.assertRaises(TypeError, lambda: Z(1, 2, 3, 4, 5, 6, 7))
 
376
 
358
377
class PointerMemberTestCase(unittest.TestCase):
359
378
 
360
379
    def test(self):