def test_load_all(marker_trackerstore: TrackerStore):
    """Tests loading trackers using 'all' strategy."""
    loader = MarkerTrackerLoader(marker_trackerstore, STRATEGY_ALL)
    result = list(loader.load())

    assert len(result) == len(list(marker_trackerstore.keys()))

    for item in result:
        assert marker_trackerstore.exists(item.sender_id)
def test_load_first_n(marker_trackerstore: TrackerStore):
    """Tests loading trackers using 'first_n' strategy."""
    loader = MarkerTrackerLoader(marker_trackerstore, STRATEGY_FIRST_N, 3)
    result = list(loader.load())

    assert len(result) == 3

    for item in result:
        assert marker_trackerstore.exists(item.sender_id)
def test_load_sample(marker_trackerstore: TrackerStore):
    """Tests loading trackers using 'sample' strategy."""
    loader = MarkerTrackerLoader(marker_trackerstore, STRATEGY_SAMPLE_N, 3)
    result = list(loader.load())

    assert len(result) == 3

    senders = set()
    for item in result:
        assert marker_trackerstore.exists(item.sender_id)
        assert item.sender_id not in senders
        senders.add(item.sender_id)
def test_load_sample_with_seed(marker_trackerstore: TrackerStore):
    """Tests loading trackers using 'sample' strategy with seed set."""
    loader = MarkerTrackerLoader(marker_trackerstore,
                                 STRATEGY_SAMPLE_N,
                                 3,
                                 seed=3)
    result = list(loader.load())
    expected_ids = ["1", "4", "3"]

    assert len(result) == 3

    for item, expected in zip(result, expected_ids):
        assert item.sender_id == expected
        assert marker_trackerstore.exists(item.sender_id)