dissect.cstruct 5.0.dev19__tar.gz → 5.0.dev20__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/CHANGELOG.md +2 -0
  2. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/PKG-INFO +1 -1
  3. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/compiler.py +2 -5
  4. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/dump.py +1 -1
  5. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/types/enum.py +7 -9
  6. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/types/structure.py +2 -1
  7. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect.cstruct.egg-info/PKG-INFO +1 -1
  8. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect.cstruct.egg-info/scm_version.json +2 -2
  9. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_bitfield.py +3 -0
  10. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_compiler.py +5 -6
  11. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_dump.py +15 -2
  12. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_types_enum.py +9 -1
  13. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/.git-blame-ignore-revs +0 -0
  14. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/.gitattributes +0 -0
  15. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/COPYRIGHT +0 -0
  16. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/LICENSE +0 -0
  17. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/MANIFEST.in +0 -0
  18. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/README.md +0 -0
  19. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/__init__.py +0 -0
  20. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/bitbuffer.py +0 -0
  21. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/cstruct.py +0 -0
  22. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/declarative.py +0 -0
  23. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/exception.py +0 -0
  24. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/expression.py +0 -0
  25. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/lexer.py +0 -0
  26. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/parser.py +0 -0
  27. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/tools/__init__.py +0 -0
  28. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/tools/stubgen.py +0 -0
  29. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/types/__init__.py +0 -0
  30. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/types/base.py +0 -0
  31. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/types/char.py +0 -0
  32. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/types/flag.py +0 -0
  33. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/types/int.py +0 -0
  34. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/types/leb128.py +0 -0
  35. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/types/packed.py +0 -0
  36. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/types/pointer.py +0 -0
  37. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/types/void.py +0 -0
  38. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/types/wchar.py +0 -0
  39. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect/cstruct/util.py +0 -0
  40. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect.cstruct.egg-info/SOURCES.txt +0 -0
  41. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect.cstruct.egg-info/dependency_links.txt +0 -0
  42. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect.cstruct.egg-info/entry_points.txt +0 -0
  43. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect.cstruct.egg-info/requires.txt +0 -0
  44. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect.cstruct.egg-info/scm_file_list.json +0 -0
  45. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/dissect.cstruct.egg-info/top_level.txt +0 -0
  46. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/examples/disk.py +0 -0
  47. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/examples/mirai.py +0 -0
  48. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/examples/pe.py +0 -0
  49. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/examples/protobuf.py +0 -0
  50. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/examples/secdesc.py +0 -0
  51. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/pyproject.toml +0 -0
  52. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/setup.cfg +0 -0
  53. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/__init__.py +0 -0
  54. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/_data/testdef.txt +0 -0
  55. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/_docs/Makefile +0 -0
  56. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/_docs/__init__.py +0 -0
  57. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/_docs/conf.py +0 -0
  58. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/_docs/index.rst +0 -0
  59. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/conftest.py +0 -0
  60. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_align.py +0 -0
  61. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_annotations.py +0 -0
  62. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_basic.py +0 -0
  63. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_benchmark.py +0 -0
  64. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_bitbuffer.py +0 -0
  65. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_ctypes.py +0 -0
  66. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_declarative.py +0 -0
  67. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_expression.py +0 -0
  68. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_lexer.py +0 -0
  69. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_parser.py +0 -0
  70. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_tools_stubgen.py +0 -0
  71. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_types_base.py +0 -0
  72. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_types_char.py +0 -0
  73. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_types_custom.py +0 -0
  74. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_types_flag.py +0 -0
  75. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_types_int.py +0 -0
  76. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_types_leb128.py +0 -0
  77. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_types_packed.py +0 -0
  78. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_types_pointer.py +0 -0
  79. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_types_structure.py +0 -0
  80. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_types_union.py +0 -0
  81. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_types_void.py +0 -0
  82. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_types_wchar.py +0 -0
  83. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/test_util.py +0 -0
  84. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tests/util.py +0 -0
  85. {dissect_cstruct-5.0.dev19 → dissect_cstruct-5.0.dev20}/tox.ini +0 -0
@@ -43,6 +43,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
43
43
  - A surrogate pair takes up two entries of a `wchar` array, so writing it no longer writes more bytes than the size of the array.
44
44
  - A `wchar` string can hold a lone surrogate, instead of raising an error for the whole structure when reading or writing it. Bytes are written back as they were stored.
45
45
  - Writing more than a single character to a `char` or `wchar` raises a `ValueError`, instead of writing all of it and moving the fields after it. An empty value is padded.
46
+ - A plain integer can be written to an enum or flag field, including a bit field.
47
+ - `dumpstruct` shows the fields of a structure in a union in a union, instead of only its `repr`.
46
48
 
47
49
  ## [4.5] - 20-05-2025
48
50
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dissect.cstruct
3
- Version: 5.0.dev19
3
+ Version: 5.0.dev20
4
4
  Summary: A Dissect module implementing a parser for C-like structures: structure parsing in Python made easy
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License-Expression: Apache-2.0
@@ -948,9 +948,8 @@ class _WriteSourceGenerator(_SourceGenerator):
948
948
  other = []
949
949
  remaining = type_.__size__ * 8
950
950
  for field in fields:
951
+ # Enum members and plain integers are shifted the same way
951
952
  value = self._load_value(field, _get_attribute("data", field._name), pack)
952
- if issubclass(field.type, (Enum, Flag)):
953
- value += "._value_"
954
953
 
955
954
  remaining -= field.bits
956
955
  little.append(f"{value} << {type_.__size__ * 8 - remaining - field.bits}")
@@ -1069,9 +1068,7 @@ class _WriteSourceGenerator(_SourceGenerator):
1069
1068
 
1070
1069
  pack.add(count, "s", var)
1071
1070
 
1072
- elif issubclass(field_type, (Enum, Flag)):
1073
- self._pack_number(read_type, f"{self._load_value(field, value, pack)}._value_", pack)
1074
-
1071
+ # Enum members and plain integers are packed the same way, as the integer type of the enum
1075
1072
  elif issubclass(read_type, Packed):
1076
1073
  pack.add(1, read_type.__fmt__, value, f"_or_default({value}, {type_})")
1077
1074
 
@@ -318,7 +318,7 @@ def _describe_value(
318
318
  Structures and unions, and arrays of them, get their fields or elements as child nodes. Other values, including
319
319
  arrays of other types, are formatted as a human-readable ``display``.
320
320
  """
321
- if isinstance(value, UnionProxy):
321
+ while isinstance(value, UnionProxy):
322
322
  # Nested Structure members inside a Union are proxied; unwrap to the real Structure
323
323
  value = value.__target__
324
324
 
@@ -1,7 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import sys
4
- from enum import Enum as _Enum
5
4
  from enum import EnumMeta, IntEnum, IntFlag
6
5
  from typing import TYPE_CHECKING, Any, BinaryIO, TypeVar, overload
7
6
 
@@ -100,16 +99,15 @@ class EnumMetaType(EnumMeta, MetaType):
100
99
  def _read_0(cls, stream: BinaryIO, *, context: dict[str, Any] | None = None, endian: Endianness) -> list[Self]:
101
100
  return list(map(cls, cls.__type__._read_0(stream, context=context, endian=endian)))
102
101
 
103
- def _write(cls, stream: BinaryIO, data: Enum, *, endian: Endianness) -> int:
104
- return cls.__type__._write(stream, data.value, endian=endian)
102
+ def _write(cls, stream: BinaryIO, data: Enum | int, *, endian: Endianness) -> int:
103
+ # Enum members are integers, so the integer type writes them like plain integers
104
+ return cls.__type__._write(stream, data, endian=endian)
105
105
 
106
- def _write_array(cls, stream: BinaryIO, array: list[BaseType | int], *, endian: Endianness) -> int:
107
- data = [entry.value if isinstance(entry, _Enum) else entry for entry in array]
108
- return cls.__type__._write_array(stream, data, endian=endian)
106
+ def _write_array(cls, stream: BinaryIO, array: list[Enum | int], *, endian: Endianness) -> int:
107
+ return cls.__type__._write_array(stream, array, endian=endian)
109
108
 
110
- def _write_0(cls, stream: BinaryIO, array: list[BaseType | int], *, endian: Endianness) -> int:
111
- data = [entry.value if isinstance(entry, _Enum) else entry for entry in array]
112
- return cls._write_array(stream, [*data, cls.__type__.__default__()], endian=endian)
109
+ def _write_0(cls, stream: BinaryIO, array: list[Enum | int], *, endian: Endianness) -> int:
110
+ return cls.__type__._write_0(stream, array, endian=endian)
113
111
 
114
112
  def cdef(cls) -> str:
115
113
  """Render this enum (or flag) back to its C-style definition.
@@ -342,7 +342,8 @@ class StructureMetaType(MetaType):
342
342
  bit_buffer = BitBuffer(stream, endian=endian)
343
343
 
344
344
  if isinstance(field_type, EnumMetaType):
345
- bit_buffer.write(field_type.__type__, value.value, field.bits)
345
+ # Enum members and plain integers are shifted into the buffer the same way
346
+ bit_buffer.write(field_type.__type__, value, field.bits)
346
347
  else:
347
348
  bit_buffer.write(field_type, value, field.bits)
348
349
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dissect.cstruct
3
- Version: 5.0.dev19
3
+ Version: 5.0.dev20
4
4
  Summary: A Dissect module implementing a parser for C-like structures: structure parsing in Python made easy
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License-Expression: Apache-2.0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "tag": "5.0.dev0",
3
- "distance": 19,
4
- "node": "gd1945fdfde0e1b01c56236bfe879659e324f5a7e",
3
+ "distance": 20,
4
+ "node": "g3e19cdfe0c0489ef470a41791188d4939a3a87f0",
5
5
  "dirty": true,
6
6
  "branch": "main",
7
7
  "node_date": "2026-11-16"
@@ -243,6 +243,9 @@ def test_bitfield_with_enum_or_flag(cs: cstruct, compiled: bool) -> None:
243
243
 
244
244
  assert obj.dumps() == buf
245
245
 
246
+ # Plain integers are written like flag members
247
+ assert cs.test(a=1, b=1, c=3, d=3).dumps() == buf
248
+
246
249
 
247
250
  def test_bitfield_char(cs: cstruct, compiled: bool) -> None:
248
251
  cdef = """
@@ -749,12 +749,11 @@ def test_generate_packed_write_numbers(cs: cstruct, TestEnum: type[Enum]) -> Non
749
749
  code = next(gen._generate_packed_source(fields))
750
750
 
751
751
  expected = """
752
- if (_value0 := data.a) is None: _value0 = _type0.__default__()
753
- if (_value1 := data.c) is None: _value1 = _type2.__default__()
752
+ if (_value0 := data.c) is None: _value0 = _type2.__default__()
754
753
  try:
755
- buf = _pack0[endian](_value0._value_, data.b, _value1.to_bytes(3, _byteorder[endian], signed=False))
754
+ buf = _pack0[endian](data.a, data.b, _value0.to_bytes(3, _byteorder[endian], signed=False))
756
755
  except _struct_error:
757
- buf = _pack0[endian](_value0._value_, _or_default(data.b, _type1), _value1.to_bytes(3, _byteorder[endian], signed=False))
756
+ buf = _pack0[endian](_or_default(data.a, _type0), _or_default(data.b, _type1), _value0.to_bytes(3, _byteorder[endian], signed=False))
758
757
  stream.write(buf)
759
758
  """ # noqa: E501
760
759
 
@@ -784,8 +783,8 @@ def test_generate_bits_write(cs: cstruct, TestEnum: type[Enum]) -> None:
784
783
  expected = """
785
784
  if (_value0 := data.a) is None: _value0 = _type0.__default__()
786
785
  if (_value1 := data.b) is None: _value1 = _type1.__default__()
787
- stream.write(_pack0[endian]((_value0 << 0 | _value1._value_ << 2 if endian == '<' else _value0 << 6 | _value1._value_ << 0)))
788
- """ # noqa: E501
786
+ stream.write(_pack0[endian]((_value0 << 0 | _value1 << 2 if endian == '<' else _value0 << 6 | _value1 << 0)))
787
+ """
789
788
 
790
789
  assert code == dedent(expected)
791
790
 
@@ -993,7 +993,7 @@ def test_dumpstruct_union_root(cs: cstruct, compiled: bool) -> None:
993
993
 
994
994
 
995
995
  def test_dumpstruct_union_nested_struct(cs: cstruct, compiled: bool) -> None:
996
- """Nested Structure members inside a Union are proxied via UnionProxy; verify unwrap."""
996
+ """Nested Structure members inside a Union are proxied via UnionProxy, twice in nested unions; verify unwrap."""
997
997
  cdef = """
998
998
  struct inner {
999
999
  uint32 a;
@@ -1004,6 +1004,11 @@ def test_dumpstruct_union_nested_struct(cs: cstruct, compiled: bool) -> None:
1004
1004
  uint8 raw[8];
1005
1005
  };
1006
1006
 
1007
+ union outer_outer {
1008
+ outer nested;
1009
+ uint8 raw[8];
1010
+ };
1011
+
1007
1012
  union anon_outer {
1008
1013
  struct {
1009
1014
  uint32 a;
@@ -1022,9 +1027,17 @@ def test_dumpstruct_union_nested_struct(cs: cstruct, compiled: bool) -> None:
1022
1027
  ]
1023
1028
  raw = {"name": "raw[8]", "type": "uint8", "offset": 0, "size": 8, "display": "[1, 0, 0, 0, 2, 0, 0, 0]"}
1024
1029
 
1030
+ outer_fields = [
1031
+ {"name": "nested", "type": "inner", "offset": 0, "size": 8, "kind": "struct", "fields": inner_fields},
1032
+ raw,
1033
+ ]
1034
+
1025
1035
  result = dumpstruct(cs.outer, buf, output="dict")
1036
+ assert result["fields"] == outer_fields
1037
+
1038
+ result = dumpstruct(cs.outer_outer, buf, output="dict")
1026
1039
  assert result["fields"] == [
1027
- {"name": "nested", "type": "inner", "offset": 0, "size": 8, "kind": "struct", "fields": inner_fields},
1040
+ {"name": "nested", "type": "outer", "offset": 0, "size": 8, "kind": "union", "fields": outer_fields},
1028
1041
  raw,
1029
1042
  ]
1030
1043
 
@@ -59,6 +59,7 @@ def test_enum_read(TestEnum: type[Enum]) -> None:
59
59
  def test_enum_write(TestEnum: type[Enum]) -> None:
60
60
  assert TestEnum.B.dumps() == b"\x02"
61
61
  assert TestEnum(b"\x02").dumps() == b"\x02"
62
+ assert TestEnum.dumps(2) == b"\x02"
62
63
 
63
64
 
64
65
  def test_enum_array_read(TestEnum: type[Enum]) -> None:
@@ -69,6 +70,8 @@ def test_enum_array_read(TestEnum: type[Enum]) -> None:
69
70
  def test_enum_array_write(TestEnum: type[Enum]) -> None:
70
71
  assert TestEnum[2]([TestEnum.B, TestEnum.C]).dumps() == b"\x02\x03"
71
72
  assert TestEnum[None]([TestEnum.B, TestEnum.C]).dumps() == b"\x02\x03\x00"
73
+ assert TestEnum[2]([2, 3]).dumps() == b"\x02\x03"
74
+ assert TestEnum[None]([2, 3]).dumps() == b"\x02\x03\x00"
72
75
 
73
76
 
74
77
  def test_enum_alias(cs: cstruct) -> None:
@@ -366,7 +369,12 @@ def test_enum_struct_write(cs: cstruct, compiled: bool) -> None:
366
369
  obj.b32 = cs.Test32.B
367
370
  obj.list = [cs.Test16.A, cs.Test16.B]
368
371
 
369
- assert obj.dumps() == b"\x01\x00\x02\x00\x01\x00\x00\x02\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x01\x00\x02\x00"
372
+ buf = b"\x01\x00\x02\x00\x01\x00\x00\x02\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x01\x00\x02\x00"
373
+ assert obj.dumps() == buf
374
+
375
+ # Plain integers are written like enum members
376
+ obj = cs.test(a16=1, b16=2, a24=1, b24=2, a32=1, b32=2, list=[1, 2])
377
+ assert obj.dumps() == buf
370
378
 
371
379
 
372
380
  def test_enum_anonymous(cs: cstruct, compiled: bool) -> None: