chaokunyang commented on code in PR #3432:
URL: https://github.com/apache/fory/pull/3432#discussion_r2867357155


##########
python/pyfory/format/tests/test_infer.py:
##########
@@ -63,6 +63,39 @@ class X:
     result = _infer_field("", X)
     assert result.type.id == TypeId.STRUCT
 
+def test_infer_field_unannotated_class():
+    """Classes without annotations should be treated as structs, not raise 
TypeError."""
+
+    class Empty:
+        pass
+
+    class WithInit:
+        def __init__(self):
+            self.x = 1
+            self.y = "hello"
+
+    # Should not raise TypeError and must be treated as STRUCT
+    assert _infer_field("", Empty).type.id == TypeId.STRUCT

Review Comment:
   This mab be wrong, only dataclass should be taken as struct. The current 
struct seiralizer is DataclassSerializer and it only support dataclass too



##########
python/pyfory/format/tests/test_infer.py:
##########
@@ -63,6 +63,39 @@ class X:
     result = _infer_field("", X)
     assert result.type.id == TypeId.STRUCT
 
+def test_infer_field_unannotated_class():
+    """Classes without annotations should be treated as structs, not raise 
TypeError."""
+
+    class Empty:
+        pass
+
+    class WithInit:
+        def __init__(self):
+            self.x = 1
+            self.y = "hello"
+
+    # Should not raise TypeError and must be treated as STRUCT
+    assert _infer_field("", Empty).type.id == TypeId.STRUCT

Review Comment:
   This may be wrong, only dataclass should be taken as struct. The current 
struct seiralizer is DataclassSerializer and it only support dataclass too



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to