From e6af96ea6d7d9e3661b48bee107632dfef967528 Mon Sep 17 00:00:00 2001 From: TrisNol Date: Thu, 21 Sep 2023 17:25:41 +0200 Subject: [PATCH] test(data-extraction): Host temporary_dir in local env --- .../unternehmensregister/transform_test.py | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/utils/data_extraction/unternehmensregister/transform_test.py b/tests/utils/data_extraction/unternehmensregister/transform_test.py index 4865880..5d7ab59 100644 --- a/tests/utils/data_extraction/unternehmensregister/transform_test.py +++ b/tests/utils/data_extraction/unternehmensregister/transform_test.py @@ -24,7 +24,7 @@ from aki_prj23_transparenzregister.utils.data_extraction.unternehmensregister im def test_transform_xml_to_json() -> None: - with TemporaryDirectory() as temp_source_dir: + with TemporaryDirectory(dir="./") as temp_source_dir: with open(os.path.join(temp_source_dir, "test.xml"), "w") as file: xml_input = """ @@ -32,7 +32,7 @@ def test_transform_xml_to_json() -> None: """ file.write(xml_input) - with TemporaryDirectory() as temp_target_dir: + with TemporaryDirectory(dir="./") as temp_target_dir: transform.transform_xml_to_json(temp_source_dir, temp_target_dir) with open(os.path.join(temp_target_dir, "test.json")) as file: json_output = json.load(file) @@ -50,7 +50,7 @@ def test_parse_stakeholder_org_hidden_in_person() -> None: "Rolle": {"Rollenbezeichnung": {"content": "Kommanditist(in)"}}, } expected_result = CompanyToCompanyRelationship( - role=RelationshipRoleEnum.KOMMANDITIST, # type: ignore + role=RelationshipRoleEnum.KOMMANDITIST, description="Some Company KG", type=CompanyRelationshipEnum.COMPANY, location=Location(**{"city": "Area 51"}), @@ -70,7 +70,7 @@ def test_parse_stakeholder_person() -> None: "Rolle": {"Rollenbezeichnung": {"content": "Geschäftsleiter(in)"}}, } expected_result = PersonToCompanyRelationship( - role=RelationshipRoleEnum.GESCHAEFTSLEITER, # type: ignore + role=RelationshipRoleEnum.GESCHAEFTSLEITER, date_of_birth="1947-09-21", name=PersonName(**{"firstname": "Stephen", "lastname": "King"}), type=CompanyRelationshipEnum.PERSON, @@ -97,7 +97,7 @@ def test_parse_stakeholder_org() -> None: } expected_result = CompanyToCompanyRelationship( description="Transparenzregister kG", - role=RelationshipRoleEnum.DIREKTOR, # type: ignore + role=RelationshipRoleEnum.DIREKTOR, type=CompanyRelationshipEnum.COMPANY, location=Location( **{ @@ -218,7 +218,7 @@ def test_map_rechtsform_from_name() -> None: def test_map_capital_kg_single() -> None: capital = Capital( - currency=CurrencyEnum.EURO, value=69000, type=CapitalTypeEnum.HAFTEINLAGE # type: ignore + currency=CurrencyEnum.EURO, value=69000, type=CapitalTypeEnum.HAFTEINLAGE ) data = { "XJustiz_Daten": { @@ -239,13 +239,13 @@ def test_map_capital_kg_single() -> None: } } - result = transform.map_capital(data, CompanyTypeEnum.KG) # type: ignore + result = transform.map_capital(data, CompanyTypeEnum.KG) assert result == capital def test_map_capital_kg_sum() -> None: capital = Capital( - currency=CurrencyEnum.EURO, value=20000, type=CapitalTypeEnum.HAFTEINLAGE # type: ignore + currency=CurrencyEnum.EURO, value=20000, type=CapitalTypeEnum.HAFTEINLAGE ) data = { "XJustiz_Daten": { @@ -274,20 +274,20 @@ def test_map_capital_kg_sum() -> None: } } - result = transform.map_capital(data, CompanyTypeEnum.KG) # type: ignore + result = transform.map_capital(data, CompanyTypeEnum.KG) assert result == capital def test_map_capital_no_fachdaten() -> None: - data = {"XJustiz_Daten": {"Fachdaten_Register": {}}} # type: ignore + data: dict = {"XJustiz_Daten": {"Fachdaten_Register": {}}} - result = transform.map_capital(data, CompanyTypeEnum.KG) # type: ignore + result = transform.map_capital(data, CompanyTypeEnum.KG) assert result is None def test_map_capital_gmbh() -> None: capital = Capital( - currency=CurrencyEnum.DEUTSCHE_MARK, value=42, type=CapitalTypeEnum.STAMMKAPITAL # type: ignore + currency=CurrencyEnum.DEUTSCHE_MARK, value=42, type=CapitalTypeEnum.STAMMKAPITAL ) data = { "XJustiz_Daten": { @@ -306,13 +306,13 @@ def test_map_capital_gmbh() -> None: } } - result = transform.map_capital(data, CompanyTypeEnum.GMBH) # type: ignore + result = transform.map_capital(data, CompanyTypeEnum.GMBH) assert result == capital def test_map_capital_ag() -> None: capital = Capital( - currency=CurrencyEnum.DEUTSCHE_MARK, value=42, type=CapitalTypeEnum.GRUNDKAPITAL # type: ignore + currency=CurrencyEnum.DEUTSCHE_MARK, value=42, type=CapitalTypeEnum.GRUNDKAPITAL ) data = { "XJustiz_Daten": { @@ -333,13 +333,13 @@ def test_map_capital_ag() -> None: } } - result = transform.map_capital(data, CompanyTypeEnum.SE) # type: ignore + result = transform.map_capital(data, CompanyTypeEnum.SE) assert result == capital def test_map_capital_personengesellschaft() -> None: capital = Capital( - currency=CurrencyEnum.DEUTSCHE_MARK, value=42, type=CapitalTypeEnum.STAMMKAPITAL # type: ignore + currency=CurrencyEnum.DEUTSCHE_MARK, value=42, type=CapitalTypeEnum.STAMMKAPITAL ) data = { "XJustiz_Daten": { @@ -358,13 +358,13 @@ def test_map_capital_personengesellschaft() -> None: } } - result = transform.map_capital(data, CompanyTypeEnum.OHG) # type: ignore + result = transform.map_capital(data, CompanyTypeEnum.OHG) assert result == capital def test_map_capital_einzelkaufmann() -> None: capital = Capital( - currency=CurrencyEnum.DEUTSCHE_MARK, value=42, type=CapitalTypeEnum.STAMMKAPITAL # type: ignore + currency=CurrencyEnum.DEUTSCHE_MARK, value=42, type=CapitalTypeEnum.STAMMKAPITAL ) data = { "XJustiz_Daten": { @@ -383,13 +383,13 @@ def test_map_capital_einzelkaufmann() -> None: } } - result = transform.map_capital(data, CompanyTypeEnum.EINZELKAUFMANN) # type: ignore + result = transform.map_capital(data, CompanyTypeEnum.EINZELKAUFMANN) assert result is None def test_map_capital_partial_null_values() -> None: capital = Capital( - currency=CurrencyEnum.DEUTSCHE_MARK, value=42, type=CapitalTypeEnum.STAMMKAPITAL # type: ignore + currency=CurrencyEnum.DEUTSCHE_MARK, value=42, type=CapitalTypeEnum.STAMMKAPITAL ) data = { "XJustiz_Daten": { @@ -408,7 +408,7 @@ def test_map_capital_partial_null_values() -> None: } } - result = transform.map_capital(data, CompanyTypeEnum.OHG) # type: ignore + result = transform.map_capital(data, CompanyTypeEnum.OHG) assert result is None @@ -573,7 +573,7 @@ def test_map_unternehmensregister_json( # noqa: PLR0913 ) -> None: expected_result = Company( **{ - "id": Mock(), # type: ignore + "id": Mock(), "name": Mock(), "location": Mock(), "last_update": Mock(),