feat: better localization of shards
Signed-off-by: Konstantin Fickel <mail@konstantinfickel.de>
This commit is contained in:
parent
79095bad4a
commit
4dbd142c74
3 changed files with 61 additions and 14 deletions
|
|
@ -5,6 +5,7 @@ from streamer.localize.localized_shard import LocalizedShard
|
|||
from streamer.localize.repostory_configuration import (
|
||||
Dimension,
|
||||
Marker,
|
||||
MarkerPlacement,
|
||||
RepositoryConfiguration,
|
||||
)
|
||||
from streamer.parse.shard import Shard, StreamFile
|
||||
|
|
@ -21,15 +22,30 @@ repository_configuration = RepositoryConfiguration(
|
|||
comment="Timestamp this entry was created at",
|
||||
propagate=True,
|
||||
),
|
||||
"timesheet": Dimension(
|
||||
display_name="Timesheet",
|
||||
comment="Time Cards for Time Tracking",
|
||||
propagate=True,
|
||||
),
|
||||
},
|
||||
markers={
|
||||
"streamer": Marker(display_name="Streamer", dimension="project"),
|
||||
"jobhunting": Marker(display_name="JobHunting", dimension="project"),
|
||||
"Streamer": Marker(
|
||||
display_name="Streamer",
|
||||
placements=[
|
||||
MarkerPlacement(dimension="project"),
|
||||
MarkerPlacement(
|
||||
if_with=["Timesheet"], dimension="timesheet", value="coding"
|
||||
),
|
||||
],
|
||||
),
|
||||
"JobHunting": Marker(
|
||||
display_name="JobHunting", placements=[MarkerPlacement(dimension="project")]
|
||||
),
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
class TestExtractDateTime:
|
||||
class TestLocalize:
|
||||
def test_project_simple_stream_file(self):
|
||||
stream_file = StreamFile(
|
||||
file_name="20250622-121000 Test File.md",
|
||||
|
|
@ -45,5 +61,27 @@ class TestExtractDateTime:
|
|||
start_line=1,
|
||||
end_line=1,
|
||||
children=[],
|
||||
location={"project": "streamer", "file": stream_file.file_name},
|
||||
location={"project": "Streamer", "file": stream_file.file_name},
|
||||
)
|
||||
|
||||
def test_timesheet_use_case(self):
|
||||
stream_file = StreamFile(
|
||||
file_name="20260131-210000 Test File.md",
|
||||
shard=Shard(start_line=1, end_line=1, markers=["Timesheet", "Streamer"]),
|
||||
)
|
||||
|
||||
assert localize_stream_file(
|
||||
stream_file, repository_configuration
|
||||
) == LocalizedShard(
|
||||
moment=datetime(2026, 1, 31, 21, 0, 0, 0),
|
||||
markers=["Timesheet", "Streamer"],
|
||||
tags=[],
|
||||
start_line=1,
|
||||
end_line=1,
|
||||
children=[],
|
||||
location={
|
||||
"file": stream_file.file_name,
|
||||
"project": "Streamer",
|
||||
"timesheet": "coding",
|
||||
},
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue