Skip to content

Commit 28975f2

Browse files
committed
remove comment in test_run_event_ql_query.py and add hash to event.py
1 parent 54e7380 commit 28975f2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

eventsourcingdb/event/event.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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

tests/test_run_eventql_query.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88

99
class TestRunEventQLQuery:
10-
# Define constants to avoid magic value comparisons
1110
EXPECTED_ROW_COUNT = 2
1211
FIRST_EVENT_ID = '0'
1312
FIRST_EVENT_VALUE = 23

0 commit comments

Comments
 (0)