File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ class Event():
1919 time : datetime
2020 data_content_type : str
2121 predecessor_hash : str
22+ hash : str
2223 trace_parent : str | None = None
2324 trace_state : str | None = None
2425
@@ -64,6 +65,11 @@ def parse(unknown_object: dict) -> "Event":
6465 if not isinstance (predecessor_hash , str ):
6566 raise ValidationError (
6667 f'Failed to parse predecessor_hash \' { predecessor_hash } \' to string.' )
68+
69+ hash = unknown_object .get ('hash' )
70+ if not isinstance (hash , str ):
71+ raise ValidationError (
72+ f'Failed to parse hash \' { hash } \' to string.' )
6773
6874 trace_parent = unknown_object .get ('traceparent' )
6975 if trace_parent is not None and not isinstance (trace_parent , str ):
@@ -91,6 +97,7 @@ def parse(unknown_object: dict) -> "Event":
9197 time = time ,
9298 data_content_type = data_content_type ,
9399 predecessor_hash = predecessor_hash ,
100+ hash = hash ,
94101 trace_parent = trace_parent ,
95102 trace_state = trace_state
96103 )
@@ -105,6 +112,7 @@ def to_json(self):
105112 'type' : self .type ,
106113 'datacontenttype' : self .data_content_type ,
107114 'predecessorhash' : self .predecessor_hash ,
115+ 'hash' : self .hash ,
108116 'data' : self .data
109117 }
110118
Original file line number Diff line number Diff line change 77
88
99class TestRunEventQLQuery :
10- # Define constants to avoid magic value comparisons
1110 EXPECTED_ROW_COUNT = 2
1211 FIRST_EVENT_ID = '0'
1312 FIRST_EVENT_VALUE = 23
You can’t perform that action at this time.
0 commit comments