structo 0.0.7__tar.gz → 0.0.8__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 (34) hide show
  1. {structo-0.0.7 → structo-0.0.8}/PKG-INFO +1 -1
  2. {structo-0.0.7 → structo-0.0.8}/structo/__init__.py +1 -1
  3. {structo-0.0.7 → structo-0.0.8}/structo/types/literal.py +1 -1
  4. structo-0.0.8/tests/test_literal.py +13 -0
  5. {structo-0.0.7 → structo-0.0.8}/.gitignore +0 -0
  6. {structo-0.0.7 → structo-0.0.8}/LICENSE +0 -0
  7. {structo-0.0.7 → structo-0.0.8}/README.md +0 -0
  8. {structo-0.0.7 → structo-0.0.8}/examples/custom_serializer.py +0 -0
  9. {structo-0.0.7 → structo-0.0.8}/examples/iterable_serializer.py +0 -0
  10. {structo-0.0.7 → structo-0.0.8}/examples/wav.py +0 -0
  11. {structo-0.0.7 → structo-0.0.8}/pyproject.toml +0 -0
  12. {structo-0.0.7 → structo-0.0.8}/pytest.ini +0 -0
  13. {structo-0.0.7 → structo-0.0.8}/structo/object.py +0 -0
  14. {structo-0.0.7 → structo-0.0.8}/structo/packed.py +0 -0
  15. {structo-0.0.7 → structo-0.0.8}/structo/serialise.py +0 -0
  16. {structo-0.0.7 → structo-0.0.8}/structo/serializer.py +0 -0
  17. {structo-0.0.7 → structo-0.0.8}/structo/types/__init__.py +0 -0
  18. {structo-0.0.7 → structo-0.0.8}/structo/types/array.py +0 -0
  19. {structo-0.0.7 → structo-0.0.8}/structo/types/blob.py +0 -0
  20. {structo-0.0.7 → structo-0.0.8}/structo/types/buffer.py +0 -0
  21. {structo-0.0.7 → structo-0.0.8}/structo/types/list.py +0 -0
  22. {structo-0.0.7 → structo-0.0.8}/structo/types/object.py +0 -0
  23. {structo-0.0.7 → structo-0.0.8}/structo/types/packed.py +0 -0
  24. {structo-0.0.7 → structo-0.0.8}/structo/types/primatives.py +0 -0
  25. {structo-0.0.7 → structo-0.0.8}/structo/types/string.py +0 -0
  26. {structo-0.0.7 → structo-0.0.8}/structo/utils.py +0 -0
  27. {structo-0.0.7 → structo-0.0.8}/tests/test_array.py +0 -0
  28. {structo-0.0.7 → structo-0.0.8}/tests/test_list.py +0 -0
  29. {structo-0.0.7 → structo-0.0.8}/tests/test_object.py +0 -0
  30. {structo-0.0.7 → structo-0.0.8}/tests/test_packed.py +0 -0
  31. {structo-0.0.7 → structo-0.0.8}/tests/test_primatives.py +0 -0
  32. {structo-0.0.7 → structo-0.0.8}/tests/test_size.py +0 -0
  33. {structo-0.0.7 → structo-0.0.8}/tests/utils.py +0 -0
  34. {structo-0.0.7 → structo-0.0.8}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: structo
3
- Version: 0.0.7
3
+ Version: 0.0.8
4
4
  Summary: Structify
5
5
  Author-email: Ben Brady <benbradybusiness@gmail.com>
6
6
  License-Expression: MIT
@@ -2,7 +2,7 @@
2
2
  Structify
3
3
  """
4
4
 
5
- __version__ = "0.0.7"
5
+ __version__ = "0.0.8"
6
6
 
7
7
  from .serializer import Serializer, Serializable
8
8
  from .serialise import get_serializer
@@ -19,7 +19,7 @@ class Literal(Serializer[bytes]):
19
19
 
20
20
  def write(self, buf, value):
21
21
  assert value in self.values, f"{value} not in {b", ".join(self.values)}"
22
- buf.write(self.values)
22
+ buf.write(value)
23
23
 
24
24
  def read(self, buf):
25
25
  value = buf.read(self._length)
@@ -0,0 +1,13 @@
1
+ from utils import test
2
+ import typing as t
3
+
4
+ import structo as st
5
+
6
+
7
+ @test("Literal: reading basic")
8
+ def _():
9
+ class Foo(st.SerializableObject):
10
+ a: t.Annotated[bytes, st.Literal(b"a", b"b")]
11
+
12
+ obj = Foo(a=b"a")
13
+ assert obj == Foo.from_bytes(obj.to_bytes())
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes