8000 gh-96925: Some tests to demonstrate the issue · matthiasgoergens/cpython@f2e6432 · GitHub
[go: up one dir, main page]

Skip to content

Commit f2e6432

Browse files
pythongh-96925: Some tests to demonstrate the issue
1 parent 2b428a1 commit f2e6432

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Lib/test/test_ctypes/test_bitfields.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,26 @@ class X(Structure):
236236
else:
237237
self.assertEqual(sizeof(X), sizeof(c_int) * 2)
238238

239+
def test_mixed_5(self):
240+
class X(Structure):
241+
_fields_ = [
242+
('A', c_uint, 1),
243+
('B', c_ushort, 16)]
244+
a = X()
245+
a.A = 0
246+
a.B = 1
247+
self.assertEqual(1, a.B)
248+
249+
def test_mixed_6(self):
250+
class X(Structure):
251+
_fields_ = [
252+
('A', c_ulonglong, 1),
253+
('B', c_uint, 32)]
254+
a = X()
255+
a.A = 0
256+
a.B = 1
257+
self.assertEqual(1, a.B)
258+
239259
def test_anon_bitfields(self):
240260
# anonymous bit-fields gave a strange error message
241261
class X(Structure):

0 commit comments

Comments
 (0)
0