Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
clairelin135 committed Nov 16, 2023
1 parent 8b656d4 commit 6ea0de0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1868,7 +1868,7 @@ def with_partitions_def(
)

def __repr__(self) -> str:
return f"PartitionKeysTimeWindowPartitionsSubset({self.get_partition_key_ranges()})"
return f"PartitionKeysTimeWindowPartitionsSubset({self.get_partition_key_ranges(self.partitions_def)})"


class TimeWindowPartitionsSubsetSerializer(NamedTupleSerializer):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
)
from dagster._check import CheckError
from dagster._core.test_utils import instance_for_test
from dagster._serdes import serialize_value


@pytest.mark.parametrize(
Expand Down Expand Up @@ -155,9 +156,12 @@ def test_static_partitions_subset_identical_serialization():
# serialized subsets should be equal if the original subsets are equal
partitions = StaticPartitionsDefinition([str(i) for i in range(1000)])
subset = [str(i) for i in range(500)]
serialized1 = partitions.subset_with_partition_keys(subset).serialize()
serialized2 = partitions.subset_with_partition_keys(reversed(subset)).serialize()
assert serialized1 == serialized2

in_order_subset = partitions.subset_with_partition_keys(subset)
reverse_order_subset = partitions.subset_with_partition_keys(reversed(subset))

assert in_order_subset.serialize() == reverse_order_subset.serialize()
assert serialize_value(in_order_subset) == serialize_value(reverse_order_subset)


def test_static_partitions_invalid_chars():
Expand Down

0 comments on commit 6ea0de0

Please sign in to comment.