data-factory-testing-framework 0.2.10__tar.gz → 0.2.11__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/PKG-INFO +1 -1
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/pyproject.toml +1 -1
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/exceptions/__init__.py +4 -0
- data_factory_testing_framework-0.2.11/src/data_factory_testing_framework/exceptions/_control_activity_expression_evaluated_not_to_expected_type.py +16 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/models/activities/_filter_activity.py +11 -5
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/models/activities/_for_each_activity.py +6 -1
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/models/activities/_if_condition_activity.py +7 -2
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/models/activities/_switch_activity.py +7 -2
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/models/activities/_until_activity.py +9 -2
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/state/_pipeline_run_state.py +2 -2
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/LICENSE +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/README.md +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/__init__.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_deserializers/__init__.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_deserializers/_deserializer_base.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_deserializers/_deserializer_data_factory.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_deserializers/_deserializer_fabric.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_deserializers/shared/__init__.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_deserializers/shared/_activity_deserializer.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_deserializers/shared/_data_factory_element_replacer.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/__init__.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/evaluator/__init__.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/evaluator/exceptions.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/evaluator/expression_evaluator.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/evaluator/expression_rule_transformer.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/evaluator/expression_terminal_transformer.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/evaluator/rules/__init__.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/evaluator/rules/activity_reference_expression_rule_evaluator.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/evaluator/rules/branch_expression_rule_evaluator.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/evaluator/rules/dataset_reference_expression_rule_evaluator.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/evaluator/rules/evaluation_expression_rule_evaluator.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/evaluator/rules/expression_parameter_expression_rule_evaluator.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/evaluator/rules/expression_rule_evaluator.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/evaluator/rules/function_call_expression_rule_evaluator.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/evaluator/rules/item_reference_expression_rule_evaluator.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/evaluator/rules/linked_service_reference_expression_rule_evaluator.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/evaluator/rules/literal_evaluation_expression_rule_evaluator.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/evaluator/rules/literal_interpolation_expression_rule_evaluator.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/evaluator/rules/logical_bool_expression_rule_evaluator.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/evaluator/rules/pipeline_reference_expression_rule_evaluator.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/evaluator/rules/system_variable_reference_expression_rule_evaluator.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/evaluator/rules/variable_reference_expression_rule_evaluator.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/functions_collection_implementation.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/functions_conversion_implementation.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/functions_date_implementation.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/functions_logical_implementation.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/functions_math_implementation.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/functions_repository.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_functions/functions_string_implementation.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_pythonnet/__init__.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_pythonnet/csharp_datetime.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_repositories/__init__.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_repositories/_factories/base_repository_factory.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_repositories/_factories/data_factory_repository_factory.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_repositories/_factories/fabric_repository_factory.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_repositories/data_factory_repository.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/_test_framework.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/exceptions/_activity_not_found_error.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/exceptions/_activity_output_field_not_found_error.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/exceptions/_data_factory_element_evaluation_error.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/exceptions/_function_call_invalid_arguments_count_error.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/exceptions/_parameter_not_found_error.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/exceptions/_pipeline_activities_circular_dependency_error.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/exceptions/_pipeline_not_found_error.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/exceptions/_state_iteration_item_not_set_error.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/exceptions/_unsupported_function_error.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/exceptions/_user_error.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/exceptions/_variable_being_evaluated_does_not_exist_error.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/exceptions/_variable_not_found_error.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/models/__init__.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/models/_data_factory_element.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/models/_data_factory_object_type.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/models/_pipeline.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/models/activities/__init__.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/models/activities/_activity.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/models/activities/_activity_dependency.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/models/activities/_append_variable_activity.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/models/activities/_control_activity.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/models/activities/_execute_pipeline_activity.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/models/activities/_fail_activity.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/models/activities/_set_variable_activity.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/py.typed +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/state/__init__.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/state/_activity_result.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/state/_dependency_condition.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/state/_pipeline_run_variable.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/state/_run_parameter.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/state/_run_parameter_type.py +0 -0
- {data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/src/data_factory_testing_framework/state/_run_state.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: data-factory-testing-framework
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.11
|
|
4
4
|
Summary: A stand-alone test framework that allows to write unit tests for Data Factory pipelines on Microsoft Fabric and Azure Data Factory.
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: fabric,datafactory,unit-testing,functional-testing,azure
|
{data_factory_testing_framework-0.2.10 → data_factory_testing_framework-0.2.11}/pyproject.toml
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "data-factory-testing-framework"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.11"
|
|
4
4
|
description = "A stand-alone test framework that allows to write unit tests for Data Factory pipelines on Microsoft Fabric and Azure Data Factory."
|
|
5
5
|
authors = ["Arjen Kroezen <arjenkroezen@microsoft.com>", "Yennifer Santos <ysantos@microsoft.com>", "Jaya Kumar <kumarjaya@microsoft.com>", "Leonard Herold <lherold@microsoft.com>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -2,6 +2,9 @@ from data_factory_testing_framework.exceptions._activity_not_found_error import
|
|
|
2
2
|
from data_factory_testing_framework.exceptions._activity_output_field_not_found_error import (
|
|
3
3
|
ActivityOutputFieldNotFoundError,
|
|
4
4
|
)
|
|
5
|
+
from data_factory_testing_framework.exceptions._control_activity_expression_evaluated_not_to_expected_type import (
|
|
6
|
+
ControlActivityExpressionEvaluatedNotToExpectedTypeError,
|
|
7
|
+
)
|
|
5
8
|
from data_factory_testing_framework.exceptions._data_factory_element_evaluation_error import (
|
|
6
9
|
DataFactoryElementEvaluationError,
|
|
7
10
|
)
|
|
@@ -32,4 +35,5 @@ __all__ = [
|
|
|
32
35
|
"UnsupportedFunctionError",
|
|
33
36
|
"VariableBeingEvaluatedDoesNotExistError",
|
|
34
37
|
"VariableNotFoundError",
|
|
38
|
+
"ControlActivityExpressionEvaluatedNotToExpectedTypeError",
|
|
35
39
|
]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from typing import Type
|
|
2
|
+
|
|
3
|
+
from data_factory_testing_framework.exceptions._user_error import UserError
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ControlActivityExpressionEvaluatedNotToExpectedTypeError(UserError):
|
|
7
|
+
"""ControlActivityExpressionEvaluatedNotToExpectedType.
|
|
8
|
+
|
|
9
|
+
This exception is raised when a ControlActivities iteration expression is not evaluating to the expected type.
|
|
10
|
+
This might be due incorrect expression or incorrectly registering activity results (e.g. registering a dictionary instead of expected list)
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
def __init__(self, activity_name: str, expected_type: Type) -> None:
|
|
14
|
+
super().__init__(
|
|
15
|
+
f"Iteration expression of Activity: '{activity_name}' does not evaluate to the expected type: '{expected_type.__name__}'."
|
|
16
|
+
)
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
from typing import Any
|
|
2
2
|
|
|
3
|
+
from data_factory_testing_framework.exceptions._control_activity_expression_evaluated_not_to_expected_type import (
|
|
4
|
+
ControlActivityExpressionEvaluatedNotToExpectedTypeError,
|
|
5
|
+
)
|
|
3
6
|
from data_factory_testing_framework.models._data_factory_element import DataFactoryElement
|
|
4
7
|
from data_factory_testing_framework.models.activities import ControlActivity
|
|
5
8
|
from data_factory_testing_framework.state import DependencyCondition, PipelineRunState
|
|
@@ -10,7 +13,7 @@ class FilterActivity(ControlActivity):
|
|
|
10
13
|
self,
|
|
11
14
|
**kwargs: Any, # noqa: ANN401
|
|
12
15
|
) -> None:
|
|
13
|
-
"""This is the class that represents the
|
|
16
|
+
"""This is the class that represents the Filter activity in the pipeline.
|
|
14
17
|
|
|
15
18
|
Args:
|
|
16
19
|
**kwargs: FilterActivity properties coming directly from the json representation of the activity.
|
|
@@ -23,13 +26,16 @@ class FilterActivity(ControlActivity):
|
|
|
23
26
|
self.condition: DataFactoryElement = self.type_properties["condition"]
|
|
24
27
|
|
|
25
28
|
def evaluate(self, state: PipelineRunState) -> "FilterActivity":
|
|
29
|
+
items = self.items.evaluate(state)
|
|
30
|
+
if not isinstance(items, list):
|
|
31
|
+
raise ControlActivityExpressionEvaluatedNotToExpectedTypeError(self.name, list)
|
|
32
|
+
|
|
26
33
|
value = []
|
|
27
|
-
for item in
|
|
28
|
-
|
|
29
|
-
if self.condition.evaluate(
|
|
34
|
+
for item in items:
|
|
35
|
+
scoped_state = state.create_iteration_scope(item)
|
|
36
|
+
if self.condition.evaluate(scoped_state):
|
|
30
37
|
value.append(item)
|
|
31
38
|
|
|
32
39
|
self.set_result(DependencyCondition.SUCCEEDED, {"value": value})
|
|
33
|
-
state.iteration_item = None
|
|
34
40
|
|
|
35
41
|
return self
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
from typing import Any, Callable, Iterator, List
|
|
2
2
|
|
|
3
|
+
from data_factory_testing_framework.exceptions._control_activity_expression_evaluated_not_to_expected_type import (
|
|
4
|
+
ControlActivityExpressionEvaluatedNotToExpectedTypeError,
|
|
5
|
+
)
|
|
3
6
|
from data_factory_testing_framework.models._data_factory_element import DataFactoryElement
|
|
4
7
|
from data_factory_testing_framework.models.activities import Activity, ControlActivity
|
|
5
8
|
from data_factory_testing_framework.state import PipelineRunState
|
|
@@ -25,7 +28,9 @@ class ForEachActivity(ControlActivity):
|
|
|
25
28
|
self.items: DataFactoryElement = self.type_properties["items"]
|
|
26
29
|
|
|
27
30
|
def evaluate(self, state: PipelineRunState) -> "ForEachActivity":
|
|
28
|
-
self.items.evaluate(state)
|
|
31
|
+
items = self.items.evaluate(state)
|
|
32
|
+
if not isinstance(items, list):
|
|
33
|
+
raise ControlActivityExpressionEvaluatedNotToExpectedTypeError(self.name, list)
|
|
29
34
|
|
|
30
35
|
super(ControlActivity, self).evaluate(state)
|
|
31
36
|
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
from typing import Any, Callable, Iterator, List
|
|
2
2
|
|
|
3
|
+
from data_factory_testing_framework.exceptions._control_activity_expression_evaluated_not_to_expected_type import (
|
|
4
|
+
ControlActivityExpressionEvaluatedNotToExpectedTypeError,
|
|
5
|
+
)
|
|
3
6
|
from data_factory_testing_framework.models._data_factory_element import DataFactoryElement
|
|
4
7
|
from data_factory_testing_framework.models.activities import Activity, ControlActivity
|
|
5
8
|
from data_factory_testing_framework.state import PipelineRunState
|
|
@@ -28,7 +31,9 @@ class IfConditionActivity(ControlActivity):
|
|
|
28
31
|
self.expression: DataFactoryElement = self.type_properties["expression"]
|
|
29
32
|
|
|
30
33
|
def evaluate(self, state: PipelineRunState) -> "IfConditionActivity":
|
|
31
|
-
self.expression.evaluate(state)
|
|
34
|
+
evaluated_expression = self.expression.evaluate(state)
|
|
35
|
+
if not isinstance(evaluated_expression, bool):
|
|
36
|
+
raise ControlActivityExpressionEvaluatedNotToExpectedTypeError(self.name, bool)
|
|
32
37
|
|
|
33
38
|
super(ControlActivity, self).evaluate(state)
|
|
34
39
|
|
|
@@ -39,7 +44,7 @@ class IfConditionActivity(ControlActivity):
|
|
|
39
44
|
state: PipelineRunState,
|
|
40
45
|
evaluate_activities: Callable[[List[Activity], PipelineRunState], Iterator[Activity]],
|
|
41
46
|
) -> Iterator[Activity]:
|
|
42
|
-
scoped_state = state.create_iteration_scope(
|
|
47
|
+
scoped_state = state.create_iteration_scope()
|
|
43
48
|
activities = self.if_true_activities if self.expression.result else self.if_false_activities
|
|
44
49
|
for activity in evaluate_activities(activities, scoped_state):
|
|
45
50
|
yield activity
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
from typing import Any, Callable, Dict, Generator, Iterator, List
|
|
2
2
|
|
|
3
|
+
from data_factory_testing_framework.exceptions._control_activity_expression_evaluated_not_to_expected_type import (
|
|
4
|
+
ControlActivityExpressionEvaluatedNotToExpectedTypeError,
|
|
5
|
+
)
|
|
3
6
|
from data_factory_testing_framework.models._data_factory_element import DataFactoryElement
|
|
4
7
|
from data_factory_testing_framework.models.activities import Activity, ControlActivity
|
|
5
8
|
from data_factory_testing_framework.state import PipelineRunState
|
|
@@ -28,7 +31,9 @@ class SwitchActivity(ControlActivity):
|
|
|
28
31
|
self.on: DataFactoryElement = self.type_properties["on"]
|
|
29
32
|
|
|
30
33
|
def evaluate(self, state: PipelineRunState) -> "SwitchActivity":
|
|
31
|
-
self.on.evaluate(state)
|
|
34
|
+
evaluated_on = self.on.evaluate(state)
|
|
35
|
+
if not isinstance(evaluated_on, str):
|
|
36
|
+
raise ControlActivityExpressionEvaluatedNotToExpectedTypeError(self.name, str)
|
|
32
37
|
|
|
33
38
|
super(ControlActivity, self).evaluate(state)
|
|
34
39
|
|
|
@@ -51,7 +56,7 @@ class SwitchActivity(ControlActivity):
|
|
|
51
56
|
activities: List[Activity],
|
|
52
57
|
evaluate_activities: Callable[[List[Activity], PipelineRunState], Iterator[Activity]],
|
|
53
58
|
) -> Generator[Activity, None, None]:
|
|
54
|
-
scoped_state = state.create_iteration_scope(
|
|
59
|
+
scoped_state = state.create_iteration_scope()
|
|
55
60
|
for activity in evaluate_activities(activities, scoped_state):
|
|
56
61
|
yield activity
|
|
57
62
|
state.add_scoped_activity_results_from_scoped_state(scoped_state)
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
from typing import Any, Callable, Iterator, List
|
|
2
2
|
|
|
3
|
+
from data_factory_testing_framework.exceptions._control_activity_expression_evaluated_not_to_expected_type import (
|
|
4
|
+
ControlActivityExpressionEvaluatedNotToExpectedTypeError,
|
|
5
|
+
)
|
|
3
6
|
from data_factory_testing_framework.models._data_factory_element import DataFactoryElement
|
|
4
7
|
from data_factory_testing_framework.models.activities import Activity, ControlActivity
|
|
5
8
|
from data_factory_testing_framework.state import DependencyCondition, PipelineRunState
|
|
@@ -34,13 +37,17 @@ class UntilActivity(ControlActivity):
|
|
|
34
37
|
evaluate_activities: Callable[[List[Activity], PipelineRunState], Iterator[Activity]],
|
|
35
38
|
) -> Iterator[Activity]:
|
|
36
39
|
while True:
|
|
37
|
-
scoped_state = state.create_iteration_scope(
|
|
40
|
+
scoped_state = state.create_iteration_scope()
|
|
38
41
|
for activity in evaluate_activities(self.activities, scoped_state):
|
|
39
42
|
yield activity
|
|
40
43
|
|
|
41
44
|
state.add_scoped_activity_results_from_scoped_state(scoped_state)
|
|
42
45
|
|
|
43
|
-
|
|
46
|
+
evaluated_expression = self.expression.evaluate(state)
|
|
47
|
+
if not isinstance(evaluated_expression, bool):
|
|
48
|
+
raise ControlActivityExpressionEvaluatedNotToExpectedTypeError(self.name, bool)
|
|
49
|
+
|
|
50
|
+
if evaluated_expression:
|
|
44
51
|
state.add_activity_result(self.name, DependencyCondition.Succeeded)
|
|
45
52
|
self.set_result(DependencyCondition.Succeeded)
|
|
46
53
|
break
|
|
@@ -70,7 +70,7 @@ class PipelineRunState(RunState):
|
|
|
70
70
|
"""Used to create a new scope for a ControlActivity like ForEach, If and Until activities.
|
|
71
71
|
|
|
72
72
|
Args:
|
|
73
|
-
iteration_item: The current item() of a ForEach activity.
|
|
73
|
+
iteration_item: The current item() of a ForEach activity. If not supplied, takes parent iteration_item.
|
|
74
74
|
|
|
75
75
|
Returns:
|
|
76
76
|
A new PipelineRunState with the scoped variables and activity results.
|
|
@@ -79,7 +79,7 @@ class PipelineRunState(RunState):
|
|
|
79
79
|
self.parameters,
|
|
80
80
|
self.variables,
|
|
81
81
|
self.activity_results,
|
|
82
|
-
iteration_item,
|
|
82
|
+
iteration_item if iteration_item is not None else self.iteration_item,
|
|
83
83
|
)
|
|
84
84
|
|
|
85
85
|
def add_scoped_activity_results_from_scoped_state(self, scoped_state: "PipelineRunState") -> None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|