From b70a24ec09b0bac2eb631279f8b6313195e8a202 Mon Sep 17 00:00:00 2001 From: RoniFS <57137532+1Rennie@users.noreply.github.com> Date: Wed, 8 May 2024 10:59:55 +0100 Subject: [PATCH] Update mock_dlt_message.py (#12) Allows the capablites to have mock data which has a storage timestamp --- src/dltlyse/mock_dlt_message.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/dltlyse/mock_dlt_message.py b/src/dltlyse/mock_dlt_message.py index 71aa596..657a8d9 100644 --- a/src/dltlyse/mock_dlt_message.py +++ b/src/dltlyse/mock_dlt_message.py @@ -34,3 +34,12 @@ class MockStorageHeader(object): def __init__(self, msec=0, sec=0): self.microseconds = msec self.seconds = sec + + +class MockDLTMessageWithTime(MockDLTMessage): + "MockDLTMessage but with storage_timestamp" + + @property + def storage_timestamp(self): + """Fake storage timestamp""" + return float("{}.{}".format(self.storageheader.seconds, self.storageheader.microseconds))