From 6ea0de0c93f72b88869ca85652e722c719ef99f2 Mon Sep 17 00:00:00 2001 From: Claire Lin Date: Wed, 15 Nov 2023 16:15:36 -0800 Subject: [PATCH] add test --- .../_core/definitions/time_window_partitions.py | 2 +- .../core_tests/partition_tests/test_partition.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/python_modules/dagster/dagster/_core/definitions/time_window_partitions.py b/python_modules/dagster/dagster/_core/definitions/time_window_partitions.py index d73fd420f096a..5d4427b6a108c 100644 --- a/python_modules/dagster/dagster/_core/definitions/time_window_partitions.py +++ b/python_modules/dagster/dagster/_core/definitions/time_window_partitions.py @@ -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): diff --git a/python_modules/dagster/dagster_tests/core_tests/partition_tests/test_partition.py b/python_modules/dagster/dagster_tests/core_tests/partition_tests/test_partition.py index d341aa18d2b53..2e3600c688961 100644 --- a/python_modules/dagster/dagster_tests/core_tests/partition_tests/test_partition.py +++ b/python_modules/dagster/dagster_tests/core_tests/partition_tests/test_partition.py @@ -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( @@ -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():