Skip to content

Commit

Permalink
Only raising exception if seed is not ordered.
Browse files Browse the repository at this point in the history
  • Loading branch information
yohplala committed Apr 18, 2024
1 parent e7effce commit ec7dc4e
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions tests/test_aggstream/test_aggstream_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -1435,17 +1435,7 @@ def post(buffer: dict, bin_res: pDataFrame):


def test_exception_unordered_seed(store, seed_path):
# Test exception when checking seed data, with seed unordered.
# - key 1: time grouper '2T', agg 'first', and 'last',
#
start = Timestamp("2020/01/01")
rr = np.random.default_rng(1)
N = 20
rand_ints = rr.integers(100, size=N)
rand_ints.sort()
ts = [start + Timedelta(f"{mn}T") for mn in rand_ints]
ref_idx = 10

# Test exception when checking seed data, with unordered seed.
ordered_on = "ts"
key_cf = {
"bin_by": TimeGrouper(key=ordered_on, freq="2T", closed="left", label="left"),
Expand All @@ -1460,6 +1450,13 @@ def test_exception_unordered_seed(store, seed_path):
max_row_group_size=max_row_group_size,
)
# Seed data.
start = Timestamp("2020/01/01")
rr = np.random.default_rng(1)
N = 20
rand_ints = rr.integers(100, size=N)
rand_ints.sort()
ts = [start + Timedelta(f"{mn}T") for mn in rand_ints]
ref_idx = 10
seed = pDataFrame({ordered_on: ts, "val": rand_ints})
# Set a 'NaT' in 'ordered_on' column, 2nd chunk for raising an exception.
seed.iloc[ref_idx, seed.columns.get_loc(ordered_on)] = pNaT
Expand Down

0 comments on commit ec7dc4e

Please sign in to comment.