Skip to content

Commit f4d2247

Browse files
test(data): document the partition_dataset rounding tests
I added docstrings to the two new tests, as suggested in review. Assisted-by: Claude Assisted-by: GPT-6 Astra Signed-off-by: mottopanikeiku <176798723+mottopanikeiku@users.noreply.github.com>
1 parent 2749499 commit f4d2247

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎tests/data/test_partition_dataset.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,22 @@ def test_value(self, input_param, result):
133133

134134
@parameterized.expand(TEST_CASES_ROUNDING)
135135
def test_ratios_rounding(self, input_param, result):
136+
"""Items left over after rounding go to the partitions that were rounded down the most.
137+
138+
Args:
139+
input_param: keyword arguments for ``partition_dataset``.
140+
result: the expected partitions.
141+
"""
136142
self.assertListEqual(partition_dataset(**input_param), result)
137143

138144
@parameterized.expand([(63, [0.8, 0.1, 0.1]), (303, [0.7, 0.15, 0.15]), (32, [1, 1, 1, 1, 1])])
139145
def test_ratios_assign_every_item(self, data_len, ratios):
146+
"""Every item lands in exactly one partition when the data is shuffled.
147+
148+
Args:
149+
data_len: number of items to partition.
150+
ratios: the partition ratios.
151+
"""
140152
data = list(range(data_len))
141153
partitions = partition_dataset(data, ratios=ratios, shuffle=True, seed=0)
142154
self.assertListEqual(sorted(i for part in partitions for i in part), data)

0 commit comments

Comments
 (0)