Skip to content

Commit

Permalink
tests: replace Wind in external id factories
Browse files Browse the repository at this point in the history
  • Loading branch information
doctrino committed Nov 16, 2024
1 parent 636ac12 commit e738a02
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions tests/test_unit/test_utils/tests_external_id_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from dataclasses import dataclass

import pytest
from windmill.data_classes import DomainModelWrite, RotorWrite, WindmillWrite
from wind_turbine.data_classes import DomainModelWrite, RotorWrite, WindTurbineWrite

from cognite.pygen.utils.external_id_factories import (
ExternalIdFactory,
Expand Down Expand Up @@ -49,7 +49,7 @@ def test_shorten_string(input_str: str, length: int, expected: str):
@pytest.mark.parametrize(
"domain_cls, data, expected, short_expected",
[
(WindmillWrite, {}, "windmill", "windmil"),
(WindTurbineWrite, {}, "windturbine", "windtur"),
(RotorWrite, {}, "rotor", "rotor"),
(FooBarApply, {}, "foobarapply", "foobara"),
],
Expand All @@ -68,7 +68,7 @@ def test_domain_name_factory(domain_cls: type, data: dict, expected: str, short_
@pytest.mark.parametrize(
"domain_cls, data",
[
(WindmillWrite, {}),
(WindTurbineWrite, {}),
(RotorWrite, {}),
(FooBarApply, {}),
],
Expand Down Expand Up @@ -107,8 +107,8 @@ def test_sha256_factory(data: dict, expected: str, short_expected: str):
@pytest.mark.parametrize(
"domain_cls, expected, expected_factory, short_expected",
[
(WindmillWrite, "1", "2", "3"),
(WindmillWrite, "4", "5", "6"),
(WindTurbineWrite, "1", "2", "3"),
(WindTurbineWrite, "4", "5", "6"),
(RotorWrite, "1", "2", "3"),
(FooBarApply, "1", "2", "3"),
],
Expand Down Expand Up @@ -161,7 +161,7 @@ def test_external_id_generator_override_false():
"testfoo|c6c9d7497c9a7d180d7c8a5f88b01a5030260cc4bc833467fcc45dcfb1a4a4d1",
),
(
WindmillWrite,
WindTurbineWrite,
{"name": "foo"},
True,
"|",
Expand Down Expand Up @@ -213,10 +213,10 @@ def test_create_external_id_factory_short():
prefix_ext_id_factory=ExternalIdFactory.domain_name_factory().short,
suffix_ext_id_factory=ExternalIdFactory.uuid_factory().short,
)
actual_1 = factory(WindmillWrite, {"name": "foo"})
actual_2 = factory(WindmillWrite, {})
actual_1 = factory(WindTurbineWrite, {"name": "foo"})
actual_2 = factory(WindTurbineWrite, {})

expected_prefix = "windmil|"
expected_prefix = "windtur|"

assert callable(factory)
assert actual_1.startswith(expected_prefix)
Expand All @@ -234,8 +234,8 @@ def test_create_external_id_factory_custom():
factory=lambda domain_cls, data: data.get("name", "no_name"), shorten_length=3
),
)
actual_1 = factory(WindmillWrite, {"name": "foo"})
actual_2 = factory(WindmillWrite, {})
actual_1 = factory(WindTurbineWrite, {"name": "foo"})
actual_2 = factory(WindTurbineWrite, {})

assert callable(factory)
assert actual_1 == "tes|foo"
Expand All @@ -252,7 +252,7 @@ def test_create_external_id_factory_custom():
"rotor:",
"c6c9d7497c9a7d180d7c8a5f88b01a5030260cc4bc833467fcc45dcfb1a4a4d1",
),
(WindmillWrite, {"name": "foobar"}, True, "windmill:", "df323f4"),
(WindTurbineWrite, {"name": "foobar"}, True, "windturbine:", "df323f4"),
],
)
def test_external_id_factories_to_be_deprecated(
Expand Down Expand Up @@ -337,5 +337,5 @@ class _FooBarWrite:

pass

assert domain_name(_FooBarWrite, {}) == "foobarwrite"
assert domain_name(WindmillWrite, {}) == "windmill"
assert domain_name(_FooBarWrite, {}) == "_foobarwrite"
assert domain_name(WindTurbineWrite, {}) == "windturbine"

0 comments on commit e738a02

Please sign in to comment.