Skip to content

Commit

Permalink
test: introduce additional tests for testing filter activity
Browse files Browse the repository at this point in the history
  • Loading branch information
arjendev committed Nov 24, 2023
1 parent 1ba6e7b commit d7d2bdb
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
import pytest
from azure_data_factory_testing_framework.models.activities.filter_activity import FilterActivity
from azure_data_factory_testing_framework.models.data_factory_element import DataFactoryElement
from azure_data_factory_testing_framework.models.pipeline import Pipeline
from azure_data_factory_testing_framework.state import RunParameter, RunParameterType
from azure_data_factory_testing_framework.test_framework import TestFramework, TestFrameworkType


def test_filter_activity_on_range_of_values() -> None:
@pytest.mark.parametrize(
"input_values,expected_filtered_values",
[
([1, 2, 3, 4, 5], [1, 2, 3]),
([], []),
([4], []),
([3, 4, 5, 6], [3]),
([4, 5, 6], []),
([-1, 3, 4], [-1, 3]),
],
)
def test_filter_activity_on_range_of_values(input_values: [], expected_filtered_values: []) -> None:
# Arrange
test_framework = TestFramework(framework_type=TestFrameworkType.Fabric)
pipeline = Pipeline(
Expand All @@ -32,12 +44,12 @@ def test_filter_activity_on_range_of_values() -> None:
activities = test_framework.evaluate_pipeline(
pipeline,
[
RunParameter(RunParameterType.Pipeline, "input_values", [1, 2, 3, 4, 5]),
RunParameter(RunParameterType.Pipeline, "input_values", input_values),
],
)

# Assert
activity = next(activities)
assert activity.type == "Filter"
assert activity.type_properties["items"].value == [1, 2, 3, 4, 5]
assert activity.output["value"] == [1, 2, 3]
assert activity.type_properties["items"].value == input_values
assert activity.output["value"] == expected_filtered_values

0 comments on commit d7d2bdb

Please sign in to comment.