ref: Remove some get_event_loop calls (#4366)
Remove some get_event_loop calls
This commit is contained in:
parent
db78e59434
commit
35e2487acb
19 changed files with 33 additions and 62 deletions
File diff suppressed because one or more lines are too long
|
|
@ -115,7 +115,7 @@ class TestEventManager:
|
|||
assert manager.events["on_test_event"].func.__name__ == "send_event"
|
||||
|
||||
# Ensuring thread-safety when accessing the events dictionary
|
||||
def test_thread_safety_accessing_events_dictionary(self):
|
||||
async def test_thread_safety_accessing_events_dictionary(self):
|
||||
def mock_callback(event_type: str, data: LoggableType):
|
||||
pass
|
||||
|
||||
|
|
@ -130,8 +130,7 @@ class TestEventManager:
|
|||
queue = asyncio.Queue()
|
||||
manager = EventManager(queue)
|
||||
|
||||
tasks = [register_events(manager), access_events(manager)]
|
||||
asyncio.get_event_loop().run_until_complete(asyncio.gather(*tasks))
|
||||
await asyncio.gather(register_events(manager), access_events(manager))
|
||||
|
||||
# Checking the performance impact of frequent event registrations
|
||||
def test_performance_impact_frequent_registrations(self):
|
||||
|
|
|
|||
|
|
@ -2,19 +2,9 @@ from langchain_core.prompts.chat import ChatPromptTemplate
|
|||
from langflow.schema.message import Message
|
||||
|
||||
|
||||
async def test_message_async_prompt_serialization():
|
||||
template = "Hello, {name}!"
|
||||
message = await Message.from_template_and_variables(template, name="Langflow")
|
||||
assert message.text == "Hello, Langflow!"
|
||||
|
||||
prompt = message.load_lc_prompt()
|
||||
assert isinstance(prompt, ChatPromptTemplate)
|
||||
assert prompt.messages[0].content == "Hello, Langflow!"
|
||||
|
||||
|
||||
def test_message_prompt_serialization():
|
||||
template = "Hello, {name}!"
|
||||
message = Message.sync_from_template_and_variables(template, name="Langflow")
|
||||
message = Message.from_template_and_variables(template, name="Langflow")
|
||||
assert message.text == "Hello, Langflow!"
|
||||
|
||||
prompt = message.load_lc_prompt()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue