49 lines
1.5 KiB
Python
49 lines
1.5 KiB
Python
from datetime import datetime
|
|
|
|
from streamer.localize.localize import localize_stream_file
|
|
from streamer.localize.localized_shard import LocalizedShard
|
|
from streamer.localize.repostory_configuration import (
|
|
Dimension,
|
|
Marker,
|
|
RepositoryConfiguration,
|
|
)
|
|
from streamer.parse.shard import Shard, StreamFile
|
|
|
|
repository_configuration = RepositoryConfiguration(
|
|
dimensions={
|
|
"project": Dimension(
|
|
display_name="Project",
|
|
comment="GTD Project that is being worked on",
|
|
propagate=True,
|
|
),
|
|
"moment": Dimension(
|
|
display_name="Moment",
|
|
comment="Timestamp this entry was created at",
|
|
propagate=True,
|
|
),
|
|
},
|
|
markers={
|
|
"streamer": Marker(display_name="Streamer", dimension="project"),
|
|
"jobhunting": Marker(display_name="JobHunting", dimension="project"),
|
|
},
|
|
)
|
|
|
|
|
|
class TestExtractDateTime:
|
|
def test_project_simple_stream_file(self):
|
|
stream_file = StreamFile(
|
|
filename="20250622-121000 Test File.md",
|
|
shard=Shard(start_line=1, end_line=1, markers=["Streamer"]),
|
|
)
|
|
|
|
assert localize_stream_file(
|
|
stream_file, repository_configuration
|
|
) == LocalizedShard(
|
|
moment=datetime(2025, 6, 22, 12, 10, 0, 0),
|
|
markers=["Streamer"],
|
|
tags=[],
|
|
start_line=1,
|
|
end_line=1,
|
|
children=[],
|
|
location={"project": "streamer"},
|
|
)
|