Skip to content

Commit

Permalink
fix #27; link and define #13,#14,#29,#30,#32,#33,#34,#35,#36
Browse files Browse the repository at this point in the history
  • Loading branch information
bensteUEM committed Mar 7, 2024
1 parent c5f9844 commit 1bc28c5
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 28 deletions.
6 changes: 3 additions & 3 deletions SNG_DEFAULTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@

SngOptionalHeader = [
"ID", # ChurchTools ID
"OTitle", # TODO Title parts slides - e.g. FJ5/073
"TitleLang2", # TODO Title parts slides - e.g. FJ5/073
"OTitle",
"TitleLang2",
"Translation",
"Bible", # Checked with Psalms only
"RECHTE", # TODO check spelling
"Rights",
]

SngIllegalHeader = [
Expand Down
21 changes: 14 additions & 7 deletions SngFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,8 @@ def validate_headers(self) -> bool:
and "Translation" not in self.header
):
missing.append("Translation")
# TODO add test case for language validation

# TODO add TitleLang2 validation
# TODO (bensteUEM): Add language validation
# https://github.com/bensteUEM/SongBeamerQS/issues/33

result = len(missing) == 0

Expand Down Expand Up @@ -334,7 +333,9 @@ def validate_header_songbook(self, fix: bool = False) -> bool:
# sample is EG 548 & WWDLP 170 = loc 77
# -> no longer needed because of regex check

# TODO low Prio - check numeric range of songbooks
# TODO (bensteUEM): low Prio - check numeric range of songbooks
# https://github.com/bensteUEM/SongBeamerQS/issues/34

# EG 1 - 851 incl.non numeric e.g. 178.14
# EG Psalms in EG Württemberg EG 701-758
# Syntax should be EG xxx - Psalm Y
Expand Down Expand Up @@ -388,8 +389,11 @@ def validate_header_background(self, fix: bool = False) -> bool:
logging.debug(error_message)
return False

# TODO validate background against resolution list #29
# TODO validate background against copyright available #30
# TODO (bensteUEM): validate background against resolution list
# https://github.com/bensteUEM/SongBeamerQS/issues/29

# TODO (bensteUEM): validate background against copyright available
# https://github.com/bensteUEM/SongBeamerQS/issues/30

def fix_header_background(self) -> bool:
"""Helper which tries to fix background image information automatically.
Expand Down Expand Up @@ -536,7 +540,10 @@ def generate_verses_from_unknown(self) -> dict | None:
"Added new '%s' in Verse Order of (%s)", new_block_keys, self.filename
)
self.content.pop("Unknown")
self.content.update(new_blocks) # TODO check what happens if already exists
self.content.update(new_blocks)
# TODO (bensteUEM): check what happens if already exists
# https://github.com/bensteUEM/SongBeamerQS/issues/35

logging.info(
"Replaced 'Unknown' with '%s' in Verse Order of (%s)",
new_block_keys,
Expand Down
10 changes: 0 additions & 10 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,13 +603,3 @@ def upload_local_songs_by_id(df_sng: pd.DataFrame, df_ct: pd.DataFrame) -> None:
"""

logging.info("Main Method finished")

# TODO Ideensammlung
# Check for leere Folie mit Strophe 0 - bsp. EG 449
# Psalm Auto Language Marking if space idented

# Check Verses in numerical order
# Replace Vers and Strophe by Verse and Chorus by Refrain

# validate_header_songbook(df, True)
# df.to_csv("Main_DF_Export.csv", quoting=csv.QUOTE_NONNUMERIC)
1 change: 0 additions & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ ignore = [

#ToDo Items
"FIX",
"TD",
]

extend-ignore = [] #Skip rules that need more code cleaning...
Expand Down
25 changes: 20 additions & 5 deletions test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,14 @@ def test_emptied_song(self) -> None:
self.assertIn("Refrain", songs_temp[0].content.keys())
songs_temp = read_baiersbronn_songs_to_df()

def test_add_id_to_local_song_if_available_in_ct(self) -> None: # TODO #13
def test_add_id_to_local_song_if_available_in_ct(self) -> None:
"""This should verify that add_id_to_local_song_if_available_in_ct is working as expected."""
self.assertFalse(True, "Not Implemented")
self.assertFalse(
True,
"Not Implemented see https://github.com/bensteUEM/SongBeamerQS/issues/13",
)
# TODO (bensteUEM): implement test_add_id_to_local_song_if_available_in_ct
# https://github.com/bensteUEM/SongBeamerQS/issues/13

def test_download_missing_online_songs(self) -> None:
"""ELKW1610.krz.tools specific test case for the named function (using 2 specific song IDs).
Expand Down Expand Up @@ -245,13 +250,23 @@ def test_download_missing_online_songs(self) -> None:
self.assertTrue(exists)
Path(test2path).unlink()

def test_upload_new_local_songs_and_generate_ct_id(self) -> None: # TODO #15
def test_upload_new_local_songs_and_generate_ct_id(self) -> None:
"""This should verify that upload_new_local_songs_and_generate_ct_id is working as expected."""
self.assertFalse(True, "Not Implemented")
self.assertFalse(
True,
"Not Implemented see https://github.com/bensteUEM/SongBeamerQS/issues/32",
)
# TODO (bensteUEM): implement test_upload_new_local_songs_and_generate_ct_id
# https://github.com/bensteUEM/SongBeamerQS/issues/32

def test_upload_local_songs_by_id(self) -> None:
"""This should verify that upload_local_songs_by_id is working as expected."""
self.assertFalse(True, "Not Implemented") # TODO #14
self.assertFalse(
True,
"Not Implemented see https://github.com/bensteUEM/SongBeamerQS/issues/14",
)
# TODO (bensteUEM): implement test_upload_local_songs_by_id
# https://github.com/bensteUEM/SongBeamerQS/issues/14

def test_write_df_to_file(self) -> None:
"""Test method checking functionality of write_df_to_file.
Expand Down
6 changes: 4 additions & 2 deletions test_sng.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,8 @@ def test_header_eg_psalm_quality_checks(self) -> None:
song = SngFile("testData/Psalm/726 Psalm 047_iso-8859-1.sng", "EG")
self.assertNotIn("ChurchSongID", song.header.keys())

# TODO Add test for language marker validation in EG psalms
# TODO (bensteUEM): Add test for language marker validation in EG psalms
# https://github.com/bensteUEM/SongBeamerQS/issues/36

# Test background image validation for EG Psalms
self.assertFalse(song.validate_header_background(fix=False))
Expand Down Expand Up @@ -680,7 +681,8 @@ def test_generate_verses_from_unknown(self) -> None:
set(expected_verse_markers) - {"STOP"}, set(existing_verse_markers)
)

# TODO optionally add test case for logged warning when new verse already exists in VerseOrder
# TODO (bensteUEM): optionally add test case for logged warning when new verse already exists in VerseOrder
# https://github.com/bensteUEM/SongBeamerQS/issues/35

def test_header_verse_order_special2(self) -> None:
"""Test case for special cases occured while running on sample files.
Expand Down

0 comments on commit 1bc28c5

Please sign in to comment.