mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-06-22 00:14:01 +02:00
refactor(data-extraction): Move date_to_iso function to string_tools
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
"""Testing utisl/data_extraction/unternehmensregister/extract.py."""
|
||||
import os
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
"""Testing utils/data_extraction/unternehmensregister/transform.py."""
|
||||
import json
|
||||
import os
|
||||
from tempfile import TemporaryDirectory
|
||||
@ -435,20 +436,6 @@ def test_map_business_purpose_no_result() -> None:
|
||||
assert result is None
|
||||
|
||||
|
||||
def test_transform_date_to_iso() -> None:
|
||||
date = "10.10.1111"
|
||||
expected_result = "1111-10-10"
|
||||
result = transform.transform_date_to_iso(date)
|
||||
assert result == expected_result
|
||||
|
||||
|
||||
def test_transform_date_to_iso_2_char_year() -> None:
|
||||
date = "10.10.98"
|
||||
expected_result = "1998-10-10"
|
||||
result = transform.transform_date_to_iso(date)
|
||||
assert result == expected_result
|
||||
|
||||
|
||||
def test_map_founding_date_from_tag_der_ersten_eintragung() -> None:
|
||||
data = {
|
||||
"some entry": "Tag der ersten Eintragung: 01.05.2004",
|
||||
|
@ -33,3 +33,15 @@ def test_simplify_string_type_error(value: Any) -> None:
|
||||
"""Tests if the type error is thrown when the value is the wrong type."""
|
||||
with pytest.raises(TypeError):
|
||||
assert string_tools.simplify_string(value)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("value", "expected"),
|
||||
[
|
||||
("10.10.1111", "1111-10-10"),
|
||||
("10.10.98", "1998-10-10"),
|
||||
],
|
||||
)
|
||||
def test_transform_date_to_iso(value: str, expected: str) -> None:
|
||||
result = string_tools.transform_date_to_iso(value)
|
||||
assert result == expected
|
||||
|
Reference in New Issue
Block a user