chore: cleanup, make pyright a bit happier

Signed-off-by: Konstantin Fickel <mail@konstantinfickel.de>
This commit is contained in:
Konstantin Fickel 2025-06-21 16:23:04 +02:00
parent 0f645e7e9b
commit 082c13b046
2 changed files with 37 additions and 72 deletions

View file

@ -27,11 +27,8 @@ class TestParseProcess:
assert parse_markdown_file(self.file_name, test_file) == StreamFile(
filename=self.file_name,
shard=Shard(
markers=[],
tags=[],
start_line=1,
end_line=3,
children=[],
),
)
@ -41,10 +38,8 @@ class TestParseProcess:
filename=self.file_name,
shard=Shard(
markers=["Tag"],
tags=[],
start_line=1,
end_line=1,
children=[],
),
)
@ -54,10 +49,8 @@ class TestParseProcess:
filename=self.file_name,
shard=Shard(
markers=["Tag1", "Tag2"],
tags=[],
start_line=1,
end_line=1,
children=[],
),
)
@ -70,7 +63,6 @@ class TestParseProcess:
tags=["Tag3"],
start_line=1,
end_line=1,
children=[],
),
)
@ -80,24 +72,18 @@ class TestParseProcess:
assert parse_markdown_file(self.file_name, file_text) == StreamFile(
filename=self.file_name,
shard=Shard(
markers=[],
tags=[],
start_line=1,
end_line=5,
children=[
Shard(
markers=["Tag1"],
tags=[],
start_line=3,
end_line=3,
children=[],
),
Shard(
markers=["Tag2"],
tags=[],
start_line=5,
end_line=5,
children=[],
),
],
),
@ -107,14 +93,11 @@ class TestParseProcess:
file_text = "Hello @Tag1 World!\n\n@Marker Block 1\n\nBlock 2 @Tag2"
assert parse_markdown_file(self.file_name, file_text).shard == Shard(
markers=[],
tags=["Tag1", "Tag2"],
start_line=1,
end_line=5,
children=[
Shard(
markers=["Marker"], tags=[], start_line=3, end_line=3, children=[]
),
Shard(markers=["Marker"], start_line=3, end_line=3, children=[]),
],
)
@ -122,11 +105,8 @@ class TestParseProcess:
file_text = "# Heading\n\n## Subheading"
assert parse_markdown_file(self.file_name, file_text).shard == Shard(
markers=[],
tags=[],
start_line=1,
end_line=3,
children=[],
)
def test_parse_split_at_heading_if_marker_on_subheading(self):
@ -135,13 +115,10 @@ class TestParseProcess:
assert parse_markdown_file(self.file_name, file_text) == StreamFile(
filename=self.file_name,
shard=Shard(
markers=[],
tags=[],
start_line=1,
end_line=5,
children=[
Shard(
markers=[],
tags=["Tag1"],
start_line=1,
end_line=4,
@ -151,13 +128,10 @@ class TestParseProcess:
tags=["Tag2"],
start_line=3,
end_line=4,
children=[],
),
],
),
Shard(
markers=[], tags=["Tag3"], start_line=5, end_line=5, children=[]
),
Shard(tags=["Tag3"], start_line=5, end_line=5, children=[]),
],
),
)
@ -172,7 +146,6 @@ class TestParseProcess:
tags=["Tag1", "Tag2"],
start_line=1,
end_line=3,
children=[],
),
)
@ -180,29 +153,21 @@ class TestParseProcess:
file_text = "Hello\n\n@Marker1 World!\n\n# @Marker2 I'm a heading!"
assert parse_markdown_file(self.file_name, file_text).shard == Shard(
markers=[],
tags=[],
start_line=1,
end_line=5,
children=[
Shard(
markers=[],
tags=[],
start_line=1,
end_line=4,
children=[
Shard(
markers=["Marker1"],
tags=[],
start_line=3,
end_line=3,
children=[],
)
],
),
Shard(
markers=["Marker2"], tags=[], start_line=5, end_line=5, children=[]
),
Shard(markers=["Marker2"], start_line=5, end_line=5, children=[]),
],
)
@ -210,52 +175,39 @@ class TestParseProcess:
file_text = "Preamble @Preamble\n## @Intro\n# @Title\n## @Chapter1\n## @Chapter2\n### Section 1\n### Section 2"
assert parse_markdown_file(self.file_name, file_text).shard == Shard(
markers=[],
tags=[],
start_line=1,
end_line=7,
children=[
Shard(
markers=[],
tags=[],
start_line=1,
end_line=2,
children=[
Shard(
markers=[],
tags=["Preamble"],
start_line=1,
end_line=1,
children=[],
),
Shard(
markers=["Intro"],
tags=[],
start_line=2,
end_line=2,
children=[],
),
],
),
Shard(
markers=["Title"],
tags=[],
start_line=3,
end_line=7,
children=[
Shard(
markers=["Chapter1"],
tags=[],
start_line=4,
end_line=4,
children=[],
),
Shard(
markers=["Chapter2"],
tags=[],
start_line=5,
end_line=7,
children=[],
),
],
),