Skip to content

Commit

Permalink
add test case for multi type filter
Browse files Browse the repository at this point in the history
  • Loading branch information
malhotra5 committed Jan 27, 2025
1 parent eeef850 commit 1f0f180
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/unit/test_event_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from openhands.events.action import (
NullAction,
)
from openhands.events.action.message import MessageAction
from openhands.events.observation import NullObservation
from openhands.storage import get_file_store

Expand Down Expand Up @@ -72,6 +73,7 @@ def test_get_matching_events_type_filter(temp_dir: str):
event_stream.add_event(NullAction(), EventSource.AGENT)
event_stream.add_event(NullObservation('test'), EventSource.AGENT)
event_stream.add_event(NullAction(), EventSource.AGENT)
event_stream.add_event(MessageAction(content='test'), EventSource.AGENT)

# Filter by NullAction
events = event_stream.get_matching_events(event_types=(NullAction,))
Expand All @@ -83,6 +85,10 @@ def test_get_matching_events_type_filter(temp_dir: str):
assert len(events) == 1
assert events[0]['observation'] == 'null'

# Filter by NullAction and MessageAction
events = event_stream.get_matching_events(event_types=(NullAction, MessageAction))
assert len(events) == 3


def test_get_matching_events_query_search(temp_dir: str):
file_store = get_file_store('local', temp_dir)
Expand Down

0 comments on commit 1f0f180

Please sign in to comment.