def test_single_bitfield_size(self):
    for c_typ in int_types:
        result = self.fail_fields(('a', c_typ, (- 1)))
        assert (result == (ValueError, 'number of bits invalid for bit field'))
        result = self.fail_fields(('a', c_typ, 0))
        assert (result == (ValueError, 'number of bits invalid for bit field'))

        class X(Structure):
            _fields_ = [('a', c_typ, 1)]
        assert (sizeof(X) == sizeof(c_typ))

        class X(Structure):
            _fields_ = [('a', c_typ, (sizeof(c_typ) * 8))]
        assert (sizeof(X) == sizeof(c_typ))
        result = self.fail_fields(('a', c_typ, ((sizeof(c_typ) * 8) + 1)))
        assert (result == (ValueError, 'number of bits invalid for bit field'))
def test_single_bitfield_size(self):
    for c_typ in int_types:
        result = self.fail_fields(('a', c_typ, (- 1)))
        assert (result == (ValueError, 'number of bits invalid for bit field'))
        result = self.fail_fields(('a', c_typ, 0))
        assert (result == (ValueError, 'number of bits invalid for bit field'))

        class X(Structure):
            _fields_ = [('a', c_typ, 1)]
        assert (sizeof(X) == sizeof(c_typ))

        class X(Structure):
            _fields_ = [('a', c_typ, (sizeof(c_typ) * 8))]
        assert (sizeof(X) == sizeof(c_typ))
        result = self.fail_fields(('a', c_typ, ((sizeof(c_typ) * 8) + 1)))
        assert (result == (ValueError, 'number of bits invalid for bit field'))