-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extract conditions and packages #257
Conversation
@freeze_time("2024-04-29") | ||
def test_save_pruefi_map_to_toml(self): | ||
""" | ||
test save_pruefi_map_to_toml. | ||
""" | ||
pruefis = { | ||
"29001": "file1.docx", | ||
"17201": "file2.docx", | ||
"37001": "file3.docx", | ||
} | ||
save_pruefi_map_to_toml(pruefis, "FV1910") | ||
expected_output_path = ( | ||
Path(__file__).parents[1] / "src" / "kohlrahbi" / "cache" / "FV1910_pruefi_docx_filename_map.toml" | ||
) | ||
assert expected_output_path.exists() | ||
expected_pruefi_map = '[meta_data]\nupdated_on = 2024-04-29\n\n[pruefidentifikatoren]\n29001 = "file1.docx"\n17201 = "file2.docx"\n37001 = "file3.docx"\n' | ||
with open(expected_output_path, "r", encoding="utf-8") as f: | ||
actual_pruefi_map = f.read() | ||
assert actual_pruefi_map == expected_pruefi_map | ||
expected_output_path.unlink() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this still needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this test as the coverage was complaining. 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove all the toml related code, because we do not use the toml pruefi map anymore.
Or am I wrong here? ^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact we used in at two instances, one unsued fct (removed now in 34d1164). The other function scans all pruefis and write the pruefi to file map to the cache which again is used in get_pruefi_to_file_mapping
in
kohlrahbi/src/kohlrahbi/ahb/__init__.py
Lines 221 to 235 in b757e59
def get_pruefi_to_file_mapping(basic_input_path: Path, format_version: EdifactFormatVersion) -> dict[str, str]: | |
"""Returns the pruefi to file mapping. If the cache file does not exist, it creates it.""" | |
default_path_to_cache_file = Path(__file__).parents[1] / "cache" / f"{format_version}_pruefi_docx_filename_map.toml" | |
if default_path_to_cache_file.exists(): | |
pruefi_to_file_mapping_cache = load_pruefi_docx_file_map_from_file(default_path_to_cache_file) | |
pruefi_to_file_mapping = pruefi_to_file_mapping_cache.get("pruefidentifikatoren") | |
if isinstance(pruefi_to_file_mapping, type(None)): | |
raise ReferenceError(f"Could not find pruefidentifikatoren in {default_path_to_cache_file}") | |
return dict(pruefi_to_file_mapping) | |
path_to_docx_files = basic_input_path / Path(f"edi_energy_de/{format_version}") | |
pruefi_to_file_mapping = find_pruefidentifikatoren(path_to_docx_files) | |
save_pruefi_map_to_toml(pruefi_to_file_mapping, format_version.value) | |
return pruefi_to_file_mapping |
Co-authored-by: kevin <[email protected]>
Co-authored-by: kevin <[email protected]>
Co-authored-by: kevin <[email protected]>
as it is not used
Co-authored-by: kevin <[email protected]>
Co-authored-by: kevin <[email protected]>
Co-authored-by: kevin <[email protected]>
…into DDB/flavour_extract_conditions
Co-authored-by: kevin <[email protected]>
Co-authored-by: kevin <[email protected]>
No description provided.