Search before asking
Version
pyfory 1.7.3
python 3.13
Component(s)
Python
Minimal reproduce step
With pyfory 1.7.3, it doesn't look like NamedTuple objects are supported.
Test case:
import pytest
import pyfory
class Record(NamedTuple):
name: str
values: tuple
count: int
@pytest.fixture(scope="session")
def fory() -> pyfory.Fory:
fory = pyfory.Fory(xlang=False, ref=False, strict=False, compatible=False)
return fory
@pytest.fixture(scope="session")
def record() -> Record:
return Record("sample", (1.0, 2.0, 3.0), 42)
def test_namedtuple_fory(fory: pyfory.Fory, record: Record):
data = fory.dumps(record)
restored = fory.loads(data)
assert isinstance(restored, Record)
assert restored == record
What did you expect to see?
I expect NamedTuple be able to roundtrip when using python to python marshalling without cross-language support.
What did you see instead?
I get this error:
FAILED test_serialization.py::test_namedtuple_fory - TypeError: Record.__new__() missing 3 required positional arguments: 'name', 'values', and 'count'
Anything Else?
No response
Are you willing to submit a PR?
Search before asking
Version
pyfory 1.7.3
python 3.13
Component(s)
Python
Minimal reproduce step
With pyfory 1.7.3, it doesn't look like
NamedTupleobjects are supported.Test case:
What did you expect to see?
I expect NamedTuple be able to roundtrip when using python to python marshalling without cross-language support.
What did you see instead?
I get this error:
Anything Else?
No response
Are you willing to submit a PR?