MCPcopy Create free account
hub / github.com/agentscope-ai/Trinity-RFT / test_file_writer

Method test_file_writer

tests/buffer/file_test.py:80–100  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

78 self.assertEqual(len(tasks), 40 - 24)
79
80 async def test_file_writer(self):
81 writer = get_buffer_writer(self.config.buffer.trainer_input.experience_buffer)
82 await writer.acquire()
83 await writer.write(
84 [
85 {"prompt": "hello world"},
86 {"prompt": "hi"},
87 ]
88 )
89 await writer.write(
90 [
91 {"prompt": "My name is"},
92 {"prompt": "What is your name?"},
93 ]
94 )
95 await writer.release()
96 file_wrapper = ray.get_actor("json-test_buffer")
97 self.assertIsNotNone(file_wrapper)
98 file_path = self.config.buffer.trainer_input.experience_buffer.path
99 with open(file_path, "r") as f:
100 self.assertEqual(len(f.readlines()), 4)
101
102 def setUp(self):
103 self.config = get_template_config()

Callers

nothing calls this directly

Calls 5

get_buffer_writerFunction · 0.90
acquireMethod · 0.45
writeMethod · 0.45
releaseMethod · 0.45
get_actorMethod · 0.45

Tested by

no test coverage detected